How to vertically align a popupmenu uicontrol with an axes ?

I am trying to vertically align an axes containing text and a popup menu uicontrol as in the following example :
F = figure('Units','normalized','Position',[0.5 0.5 0.3 0.2]);
position = [0.1 0.5 0.3 0.3];
a = axes('Position', position,...
'Visible', 'off',...
'Parent', F);
text(0,0.5,'My text','Units','Normalized')
hpop = uicontrol('Parent', F,...
'Style', 'popupmenu',...
'Units', 'Normalized',...
'Position', [position(1)+0.4 position(2:4)],...
'Enable', 'on',...
'String' , {'Choice 1','Choice 2'});
align([a,hpop],'none','middle')
The text is intentionally vertically centered in the axes to facilitate the vertical alignment with the popup menu. I used an axes with the text function to display text since the text uicontrol can not be centered vertically. Running this script returns the figure below. Setting the 'Visible' property of the axes to 'on' shows that the axes and the popup menu aren't centered vertically either.

Respuestas (1)

Turangga Lazuardi
Turangga Lazuardi el 14 de Dic. de 2015
Editada: Turangga Lazuardi el 14 de Dic. de 2015
It is aligned, you just dont see it. I made a screenshoot of what i mean

Categorías

Más información sobre Creating, Deleting, and Querying Graphics Objects en Centro de ayuda y File Exchange.

Productos

Preguntada:

el 23 de Oct. de 2015

Editada:

el 14 de Dic. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by