フィルターのクリア

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 Center および File ExchangeGraphics Objects についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by