Figure を最大化しても、Axes の縦横比を保持できますか?
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 9 Dez. 2021
Bearbeitet: MathWorks Support Team
am 9 Dez. 2021
Figure 画面を最大化すると、Axes の縦横比が変更されます。
Figure を最大化した後、縦横比を保持して表示する方法を教えてください。
Akzeptierte Antwort
MathWorks Support Team
am 9 Dez. 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Subplots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!