colorbar floods 3dplots with text

If I run the following code
x=zeros(18,18); figure;surf(x);colorbar
I get a plot of a flat plane with a nicely behaved colorbar on the right side of the plot and a scale of numbers next to the colorbar showing the values associated with specific colors.
If I run this code instead (only thing that has changed is the dimension of the matrix)
x=zeros(18,19); figure;surf(x);colorbar
I still get a plot of a flat plane but now the entire field of the plot is filled with numbers that appear to be duplications of the scale values.
Any ideas what has gone wrong? I am using Matlab 2012 a
I still see a nice plane, but the entire

Réponses (1)

Kelly Kearney
Kelly Kearney le 19 Juin 2013
Perhaps you could add a screenshot of what you see? Both lines of code produce the expected plane with colorbar plot on my system (also R2012a)... no errant text that I can see.
Without any other details, I might guess that it's an OpenGL rendering issue (most bizarre graphics display issues can be attributed to that). Does
set(gcf, 'renderer', 'zbuffer')
fix things?

3 commentaires

Mark
Mark le 19 Juin 2013
I couldn't figureout how to put a screen shot in this. However, your
set(gcf, 'renderer', 'zbuffer')
cleans it up (Thank you very very much). However I have to do that for every colorbar. Is there another workaround that I can run once per session? Otherwise I can leve with the set command.
What OS are you on?
You can run:
>>opengl software
which will use the software implementation of OpenGL to avoid the various hardware bugs. Putting this in the startup file will make it persist.
If you're on a Mac (where switching to software opengl isn't an option), you can run
opengl('neverselect')
instead, which causes Matlab to use zbuffer instead of opengl for appropriate figures.

Cette question est clôturée.

Produits

Tags

Question posée :

le 19 Juin 2013

Clôturé :

le 20 Août 2021

Community Treasure Hunt

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

Start Hunting!

Translated by