Issue with low values for surf and colorbar

2 views (last 30 days)
I was getting issues with colorbar in some of my work, so I went in to dig in the issue, and found out that surf and colorbar have weird behaviors for low values. I am using the student version 7.14.0.739 (R2012a). When I type :
surf(peaks(30))
It's all good and I get the expected plot :
But when I use a (much) smaller peaks, like in
surf(1e-7 * peaks(30))
I get no surface displayed, as below :
While pcolor still works fine, colorbar however cannot keep up, and only half of it appears in the wrong position, as in
pcolor(1e-7 * peaks(30))
colorbar
gives the following :
I am unsure but do not think the issue happens on non-student versions. Anyway, a little info on how to deal with it (apart from playing around with bigger values and renaming colorbar ticks) would be much appreciated.

Accepted Answer

Kelly Kearney
Kelly Kearney on 8 Oct 2013
Looks like an OpenGL issue. Try
set(gcf, 'renderer', 'zbuffer');
You can read up more on this, and possibly find some workarounds, here: http://www.mathworks.com/help/matlab/ref/figure_props.html#Renderer
  2 Comments
Benoit
Benoit on 8 Oct 2013
Your solution works like a charm! I had seen it before but did not think about trying it...
Thank you very much for your quick and very efficient answer!

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!