pcolor() default EdgeColor or EdgeAlpha

41 次查看(过去 30 天)
rarely do I ever plot data using pcolor() that is sparse enough for the pcolor grid lines to be sueful. Usually, I end up with a sea of blackness.
Is there a way to change the default behavior of pcolor() such that EdgeAlpha = 0 or EdgeColor = 'none'?
I do not see an option in get(0,'Factory')
x=1:200;
y=1:100;
[X, Y] = meshgrid(x, y);
dummyData = (sqrt(X.^2 + Y.^2));
area = 2;
distance = 100;
nexttile
p1=pcolor(x,y, dummyData);
title('default pcolor()')
nexttile
p2=pcolor(x,y, dummyData);
p2.EdgeAlpha = 0;
title('EdgeAlpha = 0')
nexttile
p3=pcolor(x,y, dummyData);
p3.EdgeColor = 'none';
title("EdgeColor = 'none'")

采纳的回答

Steven Lord
Steven Lord 2022-3-10
x=1:200;
y=1:100;
[X, Y] = meshgrid(x, y);
dummyData = (sqrt(X.^2 + Y.^2));
area = 2;
distance = 100;
nexttile
p1=pcolor(x,y, dummyData);
title('default pcolor()')
nexttile
pcolor creates a Surface object and you can set default property values for Surface objects.
set(groot, 'DefaultSurfaceEdgeColor', 'none')
p2=pcolor(x,y, dummyData);
title('Default EdgeColor = none')
nexttile
set(groot, 'DefaultSurfaceEdgeColor', 'r', 'DefaultSurfaceEdgeAlpha', 0.25)
pcolor(x, y, dummyData);
title('Default EdgeColor = r and EdgeAlpha = 0.25')
  1 个评论
Michael Shagam
Michael Shagam 2022-3-10
Thanks for finding that default setting @Steven Lord. I'll this to my startup file!
set(groot, 'DefaultSurfaceEdgeColor', 'none')

请先登录,再进行评论。

更多回答(1 个)

Image Analyst
Image Analyst 2022-3-10
Not sure why you're even using pcolor. I never liked how it not only put up the black lines, but that it doesn't show the last row or column. Why not use image() or imshow() instead. There are no black lines with those.
  2 个评论
Michael Shagam
Michael Shagam 2022-3-10
I'm not a fan of pcolor() either. My go-to is usually imagesc(), but I recently found some behavior in imagesc() I do not like when inputing scaled values for the x and y location values. So I am adjusting my mindset.
FYI, looking at the documentation, image() and imshow() likely have the same behavior as imagesc() since they are also intended for showing rectilinear grid data. So please be careful
Image Analyst
Image Analyst 2022-3-10
What is there to be careful about? Having pixels show up linearly (not warped or stretched) is good. You can also have the tick marks show up in either pixels, or in calibrated units if you want.
In your other post, the two plots on the left with imagesc() look great. With the plots on the right made with pcolor(), the annoying lines from the pcolor displays are probably due to aliasing due to subsampling for display and might change as you resize the figure.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Graphics Performance 的更多信息

标签

产品


版本

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by