Removing grid/edge lines in pcolor() figure

조회 수: 385 (최근 30일)
John Petersen
John Petersen 2012년 4월 30일
답변: Toshia M 2024년 10월 4일
I have a figure drawn using pcolor(). A lot of small grid lines are drawn that effectively darken the figure so that you can't see the colors well. I can remove the lines by selecting the graphic and then open the property editor and change "Edges" (shown with a drop down menu) to "no line". Is there a command I can code into my script that will do this?
  댓글 수: 2
NUR AMIRA ZULKIFLLI
NUR AMIRA ZULKIFLLI 2020년 5월 2일
편집: NUR AMIRA ZULKIFLLI 2020년 5월 26일
set(h, 'edgecolor','none') or surf(SMImage{SMImageNumber},'edgecolor','none'); fix my problem
Image Analyst
Image Analyst 2020년 5월 2일
Well you could edit the function to change varargin to tack on the 'EdgeColor', 'none' to it.
>> edit pcolor.m
But it's not recommended to alter built-in functions.
Again, pcolor does not show the last row and column. From the comments in the function "PCOLOR(C) is a pseudocolor or "checkerboard" plot of matrix C. ... the last row and column of C are not used." Here it is displaying a 4-by-4 matrix:
>> pcolor(randi(9, 4, 4))
Note: it's not 4-by-4.

댓글을 달려면 로그인하십시오.

채택된 답변

Jan
Jan 2012년 5월 1일
h = pcolor(X,Y,C);
set(h, 'EdgeColor', 'none');
  댓글 수: 3
Jan
Jan 2017년 2월 22일
This is a problem of the PDF export.
Kerry
Kerry 2018년 3월 17일
check out vecrast . It fixes the white line problem in PDF and eps plots of surfaces. It's also an efficient way to save the figure while still retaining the ability to use Illustrator (or other vector graphics tool) to edit the annotations and non-surface objects.

댓글을 달려면 로그인하십시오.

추가 답변 (4개)

Toshia M
Toshia M 2024년 10월 4일
Starting in R2024b, you can specify a name-value argument (EdgeColor="none") to remove the edge lines.
pcolor(rand(10,10),EdgeColor="none")

Image Analyst
Image Analyst 2012년 4월 30일
Tell me why you're using pcolor() instead of image(), imagesc(), or imshow(), none of which have dark lines between the pixels and all of which have a color or intensity related to one pixel's value (unlike pcolor). pcolor can show a color related to the pixel value if you use flat shading but otherwise "each cell is colored by bilinear interpolation of the colors at its four vertices, using all elements of C" - is that what you want? Plus you don't get a little colored square for each pixel even if you did use flat shading - the last row and column are missing - is that what you want? I'm sure that there is someone out there who wants the "pixel" color to depend on how tilted the tile is when tying its corners to the four corners where the pixels are, rather than depend on the color of the individual pixels, but I haven't seen anyone say so yet - they've all dumped pcolor for a regular image display function.
  댓글 수: 4
Image Analyst
Image Analyst 2012년 5월 1일
But they do different things. Why did you pick pcolor() over image()?
Jan
Jan 2012년 5월 1일
image() is faster, pcolor() is more powerful.

댓글을 달려면 로그인하십시오.


Gabor Bekes
Gabor Bekes 2017년 2월 22일
arrayfun(@(s) set(s,'EdgeColor','none'), findobj(gcf,'type','surface'))
If you have multiple pcolor plots in subplots. I also haven't found a way to set it directly when drawing.

Ben cameron
Ben cameron 2018년 6월 13일
try imagesc()

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by