pcolor() default EdgeColor or EdgeAlpha

59 views (last 30 days)
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'")

Accepted Answer

Steven Lord
Steven Lord on 10 Mar 2022
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 Comment
Michael Shagam
Michael Shagam on 10 Mar 2022
Thanks for finding that default setting @Steven Lord. I'll this to my startup file!
set(groot, 'DefaultSurfaceEdgeColor', 'none')

Sign in to comment.

More Answers (1)

Image Analyst
Image Analyst on 10 Mar 2022
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 Comments
Michael Shagam
Michael Shagam on 10 Mar 2022
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 on 10 Mar 2022
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.

Sign in to comment.

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Tags

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!