Figure を最大化しても、Axes の縦横比を保持できますか?
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MathWorks Support Team
le 9 Déc 2021
Modifié(e) : MathWorks Support Team
le 9 Déc 2021
Figure 画面を最大化すると、Axes の縦横比が変更されます。
Figure を最大化した後、縦横比を保持して表示する方法を教えてください。
Réponse acceptée
MathWorks Support Team
le 9 Déc 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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Subplots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!