Azzera filtri
Azzera filtri

yyaxis, control aspect ratio

10 visualizzazioni (ultimi 30 giorni)
Thomas Jacob
Thomas Jacob il 9 Lug 2020
Commentato: Thomas Jacob il 13 Lug 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?

Risposta accettata

Apoorv Singh
Apoorv Singh il 9 Lug 2020
  1 Commento
Thomas Jacob
Thomas Jacob il 13 Lug 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!

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Graphics Objects in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by