Axis equal doesn't work?

Hi, could anybody help me to point out why axis equal does not work in my code?
figure(19)
quiver( P1(1), P1(2), D0(1), D0(2), 0 ,'b','LineWidth',2)
hold on
quiver( P0(1), P0(2), D00(1), D00(2), 0,'b' ,'LineWidth',2)
quiver( P1(1), P1(2), D9(1), D9(2), 0, 'g' ,'LineWidth',2)
quiver( P9(1), P9(2), D99(1), D99(2), 0, 'g' ,'LineWidth',2)
quiver( P1(1), P1(2), D10(1), D10(2), 0,'r' ,'LineWidth',2)
quiver( P10(1), P10(2), D100(1), D100(2), 0 ,'r','LineWidth',2)
quiver( P1(1), P1(2), D(1), D(2), 0,'k' ,'LineWidth',2)
plot(x9,y9,'g')
plot(x10,y10,'r')
hold off
axis equal
xlabel('Re')
ylabel('Im')
set(gca, 'FontSize', 14)

5 comentarios

Jan
Jan el 7 de Jun. de 2018
We cannot run your code due to the missing data. Then there is no chance that we can guess, what "does not work" means. Please post the error message or explain the differences between the observed behavior and your expectations.
Emma Blomgren
Emma Blomgren el 7 de Jun. de 2018
Sorry, there is no error message. It's just that I would like the axes to be equal and when I plot they are not equal, although I use 'axis equal'.
Adam
Adam el 7 de Jun. de 2018
May be unrelated to the cause of the problem, but
axis( hAxes, 'equal' )
should always be used rather than just
axis equal
Why rely on an assumption as to it applying to the correct axes rather than explicitly tell it?
Adam
Adam el 7 de Jun. de 2018
Editada: Adam el 7 de Jun. de 2018
Can you attach an image then showing what the plot looks like?
Jan
Jan el 7 de Jun. de 2018
Editada: Jan el 7 de Jun. de 2018
@Emma: What do you expect "equal axes" to look like and what do you observe instead?

Iniciar sesión para comentar.

Respuestas (2)

Jan
Jan el 7 de Jun. de 2018
Editada: Jan el 7 de Jun. de 2018

1 voto

According to doc axes the command axis equal does:
Use the same length for the data units along each axis.
So it adjusts the data units or in other word the DataAspectRatio. What do you want to do instead? Maybe you mean:
axis square
Emma Blomgren
Emma Blomgren el 7 de Jun. de 2018

0 votos

Thank you for your answers, I found the solution to my problem which was to replace 'axis equal' with 'daspect([1 1 1])'.

4 comentarios

Jan
Jan el 7 de Jun. de 2018
Exactly what axis square does also.
Lawrence
Lawrence el 15 de Mzo. de 2019
Not for me. daspect([1 1 1]) does exactly what it is supposed to; axis square does not.
Jan
Jan el 16 de Mzo. de 2019
@Lawrence: The OP did not tell us, what exactly is wanted. axis square sets the PlotboxAspectRatio to [1,1,1], while axis equal adjust the DataAspectRatio. You do not mention also, what is supposed to be done. If you add this detail, other readers might profit also.
yi luo
yi luo el 25 de Abr. de 2022
Emma: Thans, I encounted the same problem, i.e., (axis equal) not working, and the daspect([1 1 1 ]) fixed it.

Iniciar sesión para comentar.

Categorías

Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 7 de Jun. de 2018

Comentada:

el 25 de Abr. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by