yyaxis, control aspect ratio

20 visualizaciones (últimos 30 días)
Thomas Jacob
Thomas Jacob el 9 de Jul. de 2020
Comentada: Thomas Jacob el 13 de Jul. de 2020
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?

Respuesta aceptada

Apoorv Singh
Apoorv Singh el 9 de Jul. de 2020
  1 comentario
Thomas Jacob
Thomas Jacob el 13 de Jul. de 2020
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!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Graphics Objects en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by