Azzera filtri
Azzera filtri

How to keep aspect ratio fixed, when rotating 3D objects in GUI?

18 visualizzazioni (ultimi 30 giorni)
I know that you can fix the aspect ration by right clicking on the axes and choosing: Rotate Options > Fixed Aspect Ratio Axes. But I'd like my GUI to do this automatically without every time manually specifying that? Is there a way to problematically achieve this? (ex.: including a command in the opening function)
thanks

Risposta accettata

Walter Roberson
Walter Roberson il 19 Giu 2012
DataAspectRatio and DataAspectRatioMode are among the properties cleared when a cla() is done, whether implicitly or explicitly. cla() is done implicitly each time you invoke a high-level graphics routine such as plot() and you do not have "hold on" or "hold all" turned on for the axes.
Therefore, instead of setting the properties in your opening function, set the properties after you plot.
  1 Commento
hana
hana il 20 Giu 2012
I did set those properties right after creating my object too, but didn't give me the desired result!
It was only after using "axis vis3d" that the aspect ratio was fixed during 3d rotation.
thank you

Accedi per commentare.

Più risposte (4)

Teja Muppirala
Teja Muppirala il 20 Giu 2012
Maybe this will do what you are trying to accomplish?
axis vis3d
  1 Commento
hana
hana il 20 Giu 2012
yes.. I came across "axis vis3d" and that solved my problem, but you have to write that every time after setting all other axes/object properties.

Accedi per commentare.


hana
hana il 19 Giu 2012
yep! I have this in the opening function, as well as right after when I create my graphical object. The funny thing is that the "Fixed Aspect Ratio Axes" is checked on, but the graphics still acts as if not fixed. If I manually turn it off and on it will be fixed!! can it be a bug?

Sean de Wolski
Sean de Wolski il 19 Giu 2012
Set the axes' DataAspectRatio and DataAspectRatioMode properties to the necessary values.
  2 Commenti
Walter Roberson
Walter Roberson il 19 Giu 2012
Sean, you had "DaraAspectRatioMode" . How old did you say your kids were? ;-)
Sean de Wolski
Sean de Wolski il 19 Giu 2012
The dogs are 9 and 12, but we adopted them late!

Accedi per commentare.


hana
hana il 19 Giu 2012
I did that already in the opening function. Unfortunately, I still have to check the "Fixed Aspect Ratio Axes" option manually on the axes :(
  1 Commento
Sean de Wolski
Sean de Wolski il 19 Giu 2012
hmmm, so you have something like:
set(handles.axes1,'dataaspectratiomode','manual');
set(handles.axes1,'dataaspectratio',[1 1 1]);
and it still comes undone?

Accedi per commentare.

Categorie

Scopri di più su Specifying Target for Graphics Output 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