mirrored axes labels with imagesc
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
when I execute the following code
a = rand(5,5)
a(3,3) = NaN
figure
imagesc(a,'AlphaData',double(~isnan(a)))
I get mirrored axes labels and also the data cursor info is mirrored. Does anybody know why and how to avoid it?
I use MATLAB R2010b on Win XP.
0 commentaires
Réponse acceptée
Plus de réponses (4)
Jarrod Rivituso
le 2 Mar 2012
Are you referring to the y-axis being in reverse direction? If so, you can set it back...
a = rand(5,5)
a(3,3) = NaN
figure
imagesc(a,'AlphaData',double(~isnan(a)))
set(gca,'YDir','normal')
3 commentaires
Jarrod Rivituso
le 2 Mar 2012
Hmm... I'm not sure exactly what you mean. Do you mean that you want the first row of your matrix to actually be the last one? If so, check out the flipud function
If you're referring to the characters on the y-axis themselves as being backwards... I've never heard of anything like that. Sorry!
Walter Roberson
le 2 Mar 2012
I *have* heard of the characters being backwards, but not for R2010b on XP. It was an earlier problem on a different OS -- OS-X is what comes to mind.
Oh, dang I'm good :) R2008a on Snow Leopard. http://www.mathworks.com/support/bugreports/585050
Image Analyst
le 2 Mar 2012
Jette, it's doing exactly as designed. With images, the generally accepted convention is that the top line is 1 and the bottom row of pixels is row N. That is exactly what you are getting. See how your axis tick marks have "1" right at the center of your top row? That's the way it is supposed to be. Note that this is different that what you get by doing a line plot with plot() or a bar chart with bar().
4 commentaires
Yair Altman
le 4 Mar 2012
I've seen the label-reversal effect before. In my experience it sometimes happens after printing/saving figures. It is an internal Matlab bug. I am guessing it's due to some clash between Java and the graphics renderer (OpenGL etc.). I have no clue how to solve this Matlab bug other than to tell you not to use Matlab's print but rather use a screen-grabber.
I really think that if you can reproduce this effect you should email Matlab's customer service (isupport@mathworks.com) - Maybe they have a workaround, and if so then please post it here for all of us.
Jan
le 4 Mar 2012
Some OpenGL drivers have this known bug, that the text is mirrored. If you have tried already to install the newest graphics drivers, this is a workaround:
feature('UseGenericOpenGL', 1)
Because this is not completely documented, this might change with the Matlab release. In Linux it might be:
feature('UseMesaSoftwareOpenGL', 1)
See:
help opengl
opengl info
0 commentaires
Shreesha Vitthala
le 8 Sep 2014
The command "opengl AUTOSELECT" worked for me...
1 commentaire
Image Analyst
le 8 Sep 2014
Worked how? Do you mean it prevented the mirror image? Where exactly in the code did you insert this function?
By the way, since I answered this two and a half years ago, I did observe it on one person's computer. It was fine on my computer and another one but one scientist had the mirror image. I changed the renderer of the figure in GUIDE to zbuffer and that fixed the problem. It also changed the colors (e.g. yellow was more vivid) for some reason.
Voir également
Catégories
En savoir plus sur Data Exploration dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!