Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Add documentation for Axes3d.view_init() angles#29114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1095,13 +1095,12 @@ def clabel(self, *args, **kwargs): | ||
def view_init(self, elev=None, azim=None, roll=None, vertical_axis="z", | ||
share=False): | ||
""" | ||
Set the elevation, azimuth,androll of the Axes, in degrees (not radians). | ||
This can be used to rotate the Axes programmatically. | ||
To look normal to the primary planes, the following elevation and | ||
azimuth angles can be used: | ||
========== ==== ==== | ||
view plane elev azim | ||
@@ -1114,6 +1113,40 @@ def view_init(self, elev=None, azim=None, roll=None, vertical_axis="z", | ||
-YZ 0 180 | ||
========== ==== ==== | ||
A roll angle of 0, 90, 180, or 270 degrees will rotate these views | ||
while keeping the axes horizontal or vertical. | ||
The *azim*, *elev*, *roll* angles correspond to rotations of the scene | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. A textual description is quite hard to follow. I suggest to instead link tohttps://matplotlib.org/devdocs/api/toolkits/mplot3d/view_angles.html#how-to-define-the-view-angle. And maybe move the quarternions there as well (in a note?). | ||
observed by a stationary camera, as follows (assuming a default vertical | ||
axis of 'z'). First, a left-handed rotation about the z axis is applied | ||
(*azim*), then a right-handed rotation about the (camera) y axis (*elev*), | ||
then a right-handed rotation about the (camera) x axis (*roll*). Here, | ||
the z, y, and x axis are fixed axes (not the axes that rotate together | ||
with the original scene). | ||
If you would like to make the connection with quaternions (because | ||
`Euler angles are horrible | ||
Contributor
| ||
<https://github.com/moble/quaternion/wiki/Euler-angles-are-horrible>`_): | ||
the *azim*, *elev*, *roll* angles relate to the (intrinsic) rotation of | ||
the plot via: | ||
*q* = exp(+roll **x̂** / 2) exp(+elev **ŷ** / 2) exp(−azim **ẑ** / 2) | ||
(with angles given in radians instead of degrees). That is, the angles | ||
are a kind of `Tait-Bryan angles | ||
<https://en.wikipedia.org/wiki/Euler_angles#Tait%E2%80%93Bryan_angles>`_: | ||
−z, +y', +x", rather than classic `Euler angles | ||
<https://en.wikipedia.org/wiki/Euler_angles>`_. | ||
To avoid confusion, provide the view angles as keyword | ||
arguments: ``.view_init(elev=30, azim=-60, roll=0, ...)``. | ||
This specific order is consistent with the order of positional arguments. | ||
Unfortunately, this order does not match the order in which rotations are | ||
applied, and it differs from the order used in other programs (``azim, elev``) | ||
and in `matplotlib.colors.LightSource`. However, it cannot be | ||
changed, since that would compromise backward compatibility. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I don't think this paragraph is needed, IMO it creates more confusion than it relieves. | ||
Parameters | ||
---------- | ||
elev : float, default: None | ||
@@ -1606,13 +1639,8 @@ def _on_move(self, event): | ||
# update view | ||
vertical_axis = self._axis_names[self._vertical_axis] | ||
self.view_init(elev, azim, roll, vertical_axis=vertical_axis, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Not that I care too much, but why are we going back here to positional arguments? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. For consistency, with: Since we are not going to change the order of the angles, there is no reason to use keyword arguments in these cases, it would just lead to duplication: elev=elev, azim=azim, roll=roll, for no benefit whatsoever, the intent is already clear without the keywords. | ||
share=True) | ||
self.stale = True | ||
# Pan | ||
Uh oh!
There was an error while loading.Please reload this page.