How do I make accurately proportioned axes?

9 ビュー (過去 30 日間)
Ashlianne Sharma
Ashlianne Sharma 2021 年 4 月 8 日
回答済み: Walter Roberson 2021 年 4 月 8 日
Hi, so I am trying to plot four contour plots on one figure (subplot).
I want the first one to be the entire domain, the second to be zoomed into something, the third zoomed into something else, the fourth zoomed into something else. So far, I have all my plots on the same figure, but I need them to have proportional axes.
figure(3)
hold on
% a) Entire domain
subplot(2,2,1)
contourf(x,y,mach)
title('Mach Subplot 1: Entire Domain')
% b) zoomed in on the air foil
subplot(2,2,2)
contourf(x,y,mach)
% axis([0 1 0 1])
title('Mach Subplot 2: Air Foil')
xlabel('Chord length')
ylabel('Height')
% c) leading edge
subplot(2,2,3)
contourf(x,y,mach)
title('Mach Subplot 3: Leading Edge')
xlabel('Chord length')
ylabel('Height')
% d) trailing edge
subplot(2,2,4)
contourf(x,y,mach)
title('Mach Subplot 4: Trailing edge')
xlabel('Chord length')
ylabel('Height')
axis equal
caxis([0 2])
hold off
This is my code I hope someone can help me (: thank you!

採用された回答

Walter Roberson
Walter Roberson 2021 年 4 月 8 日
You could linkprop the axes DataAspectRatio property, if it is a matter of getting the units to have the same ratios .
However if it is a matter of having each of the axes have the same visual ratio, then you would do something like putting each of the axes into a different uipanel, and linkprop the Position; or perhaps you could work with the PlotBoxAspectRatio; see https://www.mathworks.com/matlabcentral/answers/777872-problem-with-axis-equal#answer_654472

その他の回答 (1 件)

Ashlianne Sharma
Ashlianne Sharma 2021 年 4 月 8 日
nevermind, someone told me to just do the proportions by hand and use xlim and ylim. but if you can find me a better way, I would love that.

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by