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

조회 수: 10 (최근 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!