uicontrol vs annotation render order
Mostrar comentarios más antiguos
I was hoping to get uicontrols rendered below annotations. The order of creation of a uicontrol vs an annotation does not seem to matter, the annotation always seems to be below the control.
clf
set(gcf,'Units','normalized')
p = [0.0339 0.0452 0.1071 0.0476];
wtf2 = annotation('rectangle',[0 p(2) 1 0.1],'Color','g','FaceColor','g');
wtf = uicontrol('Style','Text','String','This is a test','Units','normalized','Position',p);
wtf3 = annotation('rectangle',[0 p(2) 1 0.1],'Color','b','FaceColor','b');
In the code example above neither annotation covers the uicontrol. Is this documented somewhere? Presumably I could use a textbox annotation to fix this behavior but I was hoping to understand the difference between annotations and uicontrols, particularly with regard to rendering.
2 comentarios
Walter Roberson
el 12 de Dic. de 2017
If I recall correctly you are using a release from R2014b onwards? Because in releases before that, uicontrol were always on top.
Jim Hokanson
el 12 de Dic. de 2017
Respuestas (1)
Amy
el 21 de Dic. de 2017
0 votos
Hi Jim - for more information on how graphics objects are rendered in releases since R2014b, try looking into these two documentation pages:
If all you want is to hide the uicontrol beneath an annotation/rectangle, you could always just set its 'Visible' property to 'off'!
1 comentario
Jim Hokanson
el 22 de Dic. de 2017
Categorías
Más información sobre Annotations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!