Changing alpha property on surface objects causes text objects in GUI to flip direction?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I'm creating a GUI that (among other things) uses surface plots in a central axes. I have a transparency button that I have written with a callback to change the alpha setting of the central axes, to adjust the transparency of the surfaces. However, this is causing the x/y/z tick numbers as well as the axis labels to 'flip', as if someone's reflected them in a mirror. It's also affecting other text objects in the GUI that aren't related to the main axes.
.
This is happening when both calling alpha(X) or using findobj('Type','Surface') and manually setting all the surface alpha values with get/set. I'm totally at a loss as to why the text objects appear to be modified at all, let alone with this particular behaviour. When I use the button again to remove the transparency, the text objects are then returned to their original state. From looking at the exact line of code that seems to cause the flip, it's simply alpha(0.8) that does it.
.
I'm running on Vista x32, R2010a.
.
That code snippet in the answer below runs fine. I can't seem to make the issue occur anywhere except in my GUI. I will see if I can repeat the error on a different version. Otherwise I can post my GUI and an example file to read into it, and perhaps you will see where the problem comes in.
.
Has anyone seen this before, or know how I can stop it happening?
1 comentario
Todd Flanagan
el 21 de En. de 2011
Walter said, "Which version are you using and which OS? I seem to recall hearing about something like this in one of the 2009 releases, possibly only for Mac OS-X.
I just looked at the code of alpha.m in 2008a and cannot see anything in there that would cause this behaviour."
Respuestas (5)
Doug Hull
el 21 de En. de 2011
The change might be because you are changing renderers when you add the transparency. Of the three renderers in MATLAB, only OpoenGL supports transparency.
Try the following one line at a time:
get(gcf,'renderer') %before and after transparency
set(gcf,'renderer','painters')
set(gcf,'renderer','zbuffer')
set(gcf,'renderer','opengl')
Did you get the text change between renderers?
Matt Fig
el 20 de En. de 2011
Would you post some code that reproduces what you see? For example, this does not reproduce what you are seeing on my machine:
[X,Y,Z] = peaks(30);
S = surf(X,Y,Z)
axis([-3 3 -3 3 -10 5])
xlabel('XLABEL'),ylabel('YLABEL'),zlabel('ZLABEL')
alpha(.8)
0 comentarios
thomas decloedt
el 29 de En. de 2011
Hi ,
i am having a related problem. I like using the patch function to show the confidence intervals of a variable. Unfortunately, setting 'FaceAlpha' to some transparent value causes the lower and left side of the box around the figure and legend to disappear. Changing the renderer to zbuffer or painters, the box reappears but then the transparency does not work.. I think it is a mac os x 10.6/matlab compatibility problem? Bummed that plotting figures on mac in matlab does weird stuff i never saw before on older macs
MATLAB Version 7.10.0.499 (R2010a) MATLAB License Number: ########## [SCd Censor] Operating System: Mac OS X Version: 10.6.6 Build: 10J567 Java VM Version: Java 1.6.0_22-b04-307-10M3261 with Apple Inc. Java HotSpot™ 64-Bit Server VM mixed mode ---------------------------------------------------------------------
Brett Shoelson
el 4 de Feb. de 2011
Emily, You've run into a known issue with an incompatibility between your hardware and your version of OpenGL. You can circumvent the problem by implementing openGL in software, rather than in hardware. Try executing:
openGL software
and rerun... Cheers, Brett
3 comentarios
Brett Shoelson
el 9 de Feb. de 2011
Unfortunately, Emily, I don't have a workaround for issues caused by switching to software rendering. It may sound like a cop-out, but it's not really a MATLAB issue. Sorry.
Tong
el 24 de Nov. de 2011
Just want to leave a words to express my thanks to Brett. I ran the code and fixed my problem of the mirrored ticks, ending up my effort to solve it after quite a lot of time.
0 comentarios
Ver también
Categorías
Más información sobre Graphics Performance en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!