Bug in pcolor?
Show older comments
Hi,
Whenever I use pcolor for a checkerboard plot the lines of my x-axis and y-axis disappear. This problem can be reproduced even with the example in the matlab help!
Try this (looks OK):
figure;
pcolor(hadamard(20))
colormap(gray(2))
shading flat;
axis ij
axis square
and compare against this (x,y axis disappears):
figure;
pcolor(hadamard(20))
colormap(gray(2))
shading flat;
axis ij
For whatever reason using pcolor together with shading flat makes the axis disappear (only the axis on the bottom and left of the plot). Why is that and why does using the axis square command make a difference?
In principle the axis square command would fix the problem but I don't want my axes to be square. Using axis normal instead does NOT fix the problem...
Any ideas?
2 Comments
Walter Roberson
on 30 Dec 2011
It took me a moment to see what you were describing; the solid line on the top and right sides are not present with a plain pcolor() if the OpenGL renderer is in effect. painters and zbuffer renderer do not have this difficulty.
Image Analyst
on 31 Dec 2011
I was wondering why you're using pcolor() in the first place instead of image(). Do you know it's going to display a 19x19 grid and not a 20x20 grid? And the color of the tile in pcolor is not the value of the array you're displaying? When I ask I never have gotten a reason, all I get is people either not answering at all, or they say "No I never realized pcolor did that. That's not what I want."
Accepted Answer
More Answers (2)
This is really old but in case anyone looking for a nice solution, just use
set(gca,'layer','top','Box','on');
Muhlbauer
on 3 Jan 2012
0 votes
1 Comment
Jan
on 3 Jan 2012
It happens with LINE also, and to be exact, even *without* LINE:
figure('Renderer', 'OpenGL');
AxesH = axes('Units', 'pixels', 'Position', [40, 40, 200, 200], ...
'YLim', [0, 20.7], 'Box', 'on', 'XGrid', 'on', 'YGrid', 'on');
This shows, that it only depends on the limits and the extent of the AXES. PCOLOR is not the problem.
Categories
Find more on Graphics Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!