How can I centre an axes object in a GUI figure?

1 Ansicht (letzte 30 Tage)
George
George am 8 Feb. 2018
Kommentiert: Geoff Hayes am 8 Feb. 2018
I have created a GUI figure containing an axes object (for displaying images), along with a few objects such as buttons. I have set the size of the GUI figure to fill most of the screen, whatever the PC's screen size, using:
set(gcf, 'units', 'normalized', 'position', [0.05 0.15 0.9 0.8]);
in OpeningFcn. This seems to work OK, But the axes object within the figure always hugs the left side of the GUI figure. How can I make it stay in the middle of the figure regardless of the latter's size? Ideally the other objects also need to stay evenly spaced horizontally too. Online help talks about using a call to align with 'bounding box', but I can't see how to set a bounding box for a group of objects, so that the group remains centred in the GUI. Any suggestions please? Thanks, George
  1 Kommentar
Geoff Hayes
Geoff Hayes am 8 Feb. 2018
George - are you using GUIDE (since you have an OpeningFcn) or are you programmatically creating your GUI? If the former, you could look at GUIDE GUI options and perhaps select a proportional resize behaviour.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by