Figure を最大化しても、Axes の縦横比を保持できますか?

33 ビュー (過去 30 日間)
MathWorks Support Team
MathWorks Support Team 2021 年 12 月 9 日
編集済み: MathWorks Support Team 2021 年 12 月 9 日
Figure 画面を最大化すると、Axes の縦横比が変更されます。
Figure を最大化した後、縦横比を保持して表示する方法を教えてください。

採用された回答

MathWorks Support Team
MathWorks Support Team 2021 年 12 月 9 日
Axes の単位(Units プロパティ) は、'normalized' がデフォルト設定となり、Figure のサイズに比例して Axes も自動的にサイズが変更されます。
 対策としては、Figure 画面を最大化する前に縦横比を pbaspect 関数で取得しておき、画面最大化後に、元の縦横比を再設定する方法が考えられます。
% サンプルの Figure 作成
f = figure;
for n = 1:4
subplot(2,2,n); plot(rand(1,10))
end
% 縦横比を取得
pba = pbaspect;
% 画面最大化
f.WindowState = 'maximized';
% 縦横比の再設定
ax = findobj(f,'Type','Axes'); % Axes のハンドルを取得
for n = 1:length(ax)
pbaspect(ax(n),pba) % 縦横比を設定
end
関連する情報が以下の URL よりご覧いただけます。

その他の回答 (0 件)

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!