フィルターのクリア

how (in a program) to dock figures side by side

115 ビュー (過去 30 日間)
Chris Barnhart
Chris Barnhart 2015 年 1 月 24 日
編集済み: Matt J 2024 年 3 月 1 日
I want to dock figures (within a program) as shown in the image attached using a program. What handle properties do I need to set to achieve this?
The script below puts figures into 3 tabs such that only 1 is visible at a time. To get what I want, I grab figure 1 tab, move until a block box splits the figures. Then I adjust with pane width by grabbing the line separating the panes.
h=figure(1); plot(1,1); set(h,'WindowStyle','docked')
h=figure(2); plot(2,2); set(h,'WindowStyle','docked')
h=figure(3); plot(3,3); set(h,'WindowStyle','docked')
When I move the figure from the docked tabbed arrangement to the side by side arrangement there is only a change in the position property of the figure. When tabbed, the position is of the form [1 1 width height], and when side-by-side (on the left) it becomes [4 4 width/2 height] or if on right, [width/2 4 width height]. I've tried setting the position both with set and inspect but an error is generated.
  1 件のコメント
Chris Barnhart
Chris Barnhart 2015 年 1 月 31 日
Mathworks states there is no way to do this with multiple figures as of 2014b.

サインインしてコメントする。

回答 (2 件)

Image Analyst
Image Analyst 2015 年 1 月 31 日
Set the 'OuterPosition' property of the figure:
h1 = figure;
plot(rand(1, 10));
% Make figure fit in upper left quadrant..
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0, 0.5, 0.5, 0.5]);
h2 = figure;
plot(rand(1, 10));
% Make figure fit in upper right quadrant..
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0.5, 0.5, 0.5, 0.5]);
h3 = figure;
plot(rand(1, 10));
% Make figure fit in lower left quadrant..
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0, 0, 0.5, 0.5]);
h4 = figure;
plot(rand(1, 10));
% Make figure fit in lower left quadrant..
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0.5, 0, 0.5, 0.5]);
  1 件のコメント
Chris Barnhart
Chris Barnhart 2015 年 2 月 20 日
Was looking for a single figure with subplots that are docked so they can be manipulated as a single group.

サインインしてコメントする。


Matt J
Matt J 2016 年 2 月 2 日
編集済み: Matt J 2016 年 2 月 2 日
If it will always be a 1x3 arrangement (or smaller), then you could first template one manually using the arrangement controls in the figure window
This results in, for example,
Thereafter, figures will always dock this way, even when done programmatically,
>> h=[figure(1), figure(2), figure(3)];
>> set(h, 'WindowStyle', 'Docked');
  3 件のコメント
nicolas pothier
nicolas pothier 2024 年 3 月 1 日
How to do it automatically ?
Matt J
Matt J 2024 年 3 月 1 日
編集済み: Matt J 2024 年 3 月 1 日
@Andrey Revyakin , @nicolas pothier You must follow these steps:
(1) undock the figure window from the Matlab desktop window
(2) spread the windows out side-by-side using the layour controls as I mentioned
(3) redock them in the Matlab desktop
Subsequent to this, future figure plots will be automatically docked in this arrangement.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by