필터 지우기
필터 지우기

yyaxis, control aspect ratio

조회 수: 10 (최근 30일)
Thomas Jacob
Thomas Jacob 2020년 7월 9일
댓글: Thomas Jacob 2020년 7월 13일
Hi,
I'm trying to create a plot with 2 y-axis using yyaxis.
I would like to to set one of the two y-axis to have an aspect ratio of one in comparison with the x-axis.
I tried
set(gca,'DataAspectRatio',[1 1 1])
and
axis equal
but it throw the following error: "Warning: Only 'auto' DataAspectRatio is supported for axes with multiple coordinate systems."
Is there a way around this limitation?

채택된 답변

Apoorv Singh
Apoorv Singh 2020년 7월 9일
  댓글 수: 1
Thomas Jacob
Thomas Jacob 2020년 7월 13일
Thanks. Altough it did not work for me, it sent me on the right track. Indeed, if I resize the windows in which the figure appears, the proportion of the plot still changes.
I'm trying to plot an aerofoil with its pressure distribution. This is why the ratio y, x size is important.
I found a workaround in the following form:
figure
ax = gca;
yyaxis left
plot(x , y_left)
ylim([-0.5 0.5])
xlim([0 1])
yyaxis right
plot(x , y_right)
ylim([-1.5 4])
Basically this is what comes from the link you gave me, but as I wrote if I resize the windows in wich the plot is made, the ratio is then broken.
The following line forces the plot to be a square, whatever the size of the window in which it is plotted.
ax.PlotBoxAspectRatio = [1 1 1];
Thanks for the help!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Objects에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by