Positioning a figure

3 次查看(过去 30 天)
Venkat Alagarsamy
Venkat Alagarsamy 2011-3-18
Is there no way to change the position of a figure if it is docked. I am trying to place three child dockable figures into a main figure and want to set the position of the three child figures. Is that possible??

回答(1 个)

Ayush Anand
Ayush Anand 2024-4-4
Hi,
In MATLAB, when you dock figures MATLAB's IDE manages their layout, and direct control over the positioning of docked figures is limited, as docked figures are managed by the MATLAB Desktop, and specific positioning is typically handled through the desktop layout rather than programmatically. However, you might consider alternative approaches that give you more control over the layout, like using the "uipanel" within a figure.
Instead of using docked figures, you can create a single main figure and divide it into sections using "uipanel". Each "uipanel" can act as a container for other UI components or custom plots. This approach gives you full control over the size and position of each panel within the main figure.
mainFig = figure('Name', 'Main Figure', 'Position', [100, 100, 800, 600]);
% Create three panels within the main figure
panel1 = uipanel('Parent', mainFig, 'Position', [0, 2/3, 1, 1/3], 'Title', 'Panel 1');
panel2 = uipanel('Parent', mainFig, 'Position', [0, 1/3, 1/2, 1/3], 'Title', 'Panel 2');
panel3 = uipanel('Parent', mainFig, 'Position', [1/2, 1/3, 1/2, 1/3], 'Title', 'Panel 3');
% Example of adding a plot to a panel
axes('Parent', panel1);
plot(sin(1:0.1:25));
You can read more about "uipanel" in MATLAB here: https://www.mathworks.com/help/matlab/ref/uipanel.html
Hope this helps!

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by