How to deal with misaligment of y axes across sublots when changing the size of a figure?

2 ビュー (過去 30 日間)
Tomaszzz
Tomaszzz 2023 年 1 月 26 日
コメント済み: Tomaszzz 2023 年 1 月 27 日
Hi all,
I have created a figure (see the figure below, left)
figure
set(0, "DefaultAxesFontSize",8)
subplot(3,2,[1,2])
plot......
subplot(3,2,[3,4])
plot......
subplot(3,2,5)
plot......
subplot(3,2,6)
plot......
I then change the size of the figure.
picturewidth = 9.7;
hw_ratio = 1;
set (figure(1),'Units','centimeters','Position',[3 3 picturewidth hw_ratio*picturewidth]);
This results in (figure below, on the right):
-misaligment of y axes in subplot (3,2,[3,4]) and (3,2,5) (see red circle)
- last two subplts covering x axis title in subplot above (see red circle)
Can you please advise how to deal with this?
  2 件のコメント
dpb
dpb 2023 年 1 月 26 日
編集済み: dpb 2023 年 1 月 26 日
You've changed the default height:width ratio as well as just reducing the size; not surprised that fouls things up.
I suggest if you want a specific size that you set those parameters before drawing on the figure...iow, create and resize the figure first, not last.
Tomaszzz
Tomaszzz 2023 年 1 月 27 日
Thanks @dpb. Changing the order, as you suggested, seems not to work either. When I slightly manually increase the width of the figure, the y axes align back again.

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeSubplots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by