Figure を最大化しても、Axes の縦横比を保持できますか?
35 views (last 30 days)
Show older comments
MathWorks Support Team
on 9 Dec 2021
Edited: MathWorks Support Team
on 9 Dec 2021
Figure 画面を最大化すると、Axes の縦横比が変更されます。
Figure を最大化した後、縦横比を保持して表示する方法を教えてください。
Accepted Answer
MathWorks Support Team
on 9 Dec 2021
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 Comments
More Answers (0)
See Also
Categories
Find more on Subplots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!