问题
I'm trying to make contour map and have been stuck putting a colorbar onto the figure. I am currently using the following code:
abi = -7:0.1:4;
sbi = 0:1:75;
[xx, yy] = meshgrid(sbi(2:end), abi(2:end));
contour(xx', yy', rm3d);
colorbar;
Where rm3d is a set a values corresponding to each intersection point between abi and sbi.
Everything works as expected through the contour line, but the colorbar does something funky. Looks like it is populating numbers across the screen, as in this picture:

Only problem is that when I export this figure (as a *.png), it looks just fine:

Anyone have any idea of the issue with the non-exported image? Resizing the image did not help.
Thanks.
回答1:
As described in the comments, the solution is to use:
set(gcf, 'renderer', 'zbuffer')
As explained on http://www.mathworks.nl/matlabcentral/answers/53874
来源:https://stackoverflow.com/questions/18021851/colorbar-in-matlab-placing-too-many-numbers-in-figure