필터 지우기
필터 지우기

pcolor() default EdgeColor or EdgeAlpha

조회 수: 41 (최근 30일)
Michael Shagam
Michael Shagam 2022년 3월 10일
댓글: Image Analyst 2022년 3월 10일
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