yyaxis, control aspect ratio

10 次查看(过去 30 天)
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