8000 Update view_angles documentation · matplotlib/matplotlib@5c17e59 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5c17e59

Browse files
committed
Update view_angles documentation
- clarify rotations in view_angles.rst using Euler angles (connection with quaternion still mentioned but less prominently) - fix reference in whats_new\view_angles_order.rst - add keywords in plot annotation in view_planes_3d.py example (and documentation)
1 parent a2caf5e commit 5c17e59

File tree

3 files changed

+17
-8
lines changed
  • galleries/examples/mplot3d
  • 3 files changed

    +17
    -8
    lines changed

    doc/api/toolkits/mplot3d/view_angles.rst

    Lines changed: 15 additions & 6 deletions
    Original file line numberDiff line numberDiff line change
    @@ -31,15 +31,24 @@ as well as roll, and all three angles can be set programmatically::
    3131
    Rotation of the plot
    3232
    ====================
    3333

    34-
    The angles relate to the (intrinsic) rotation of the plot via the
    35-
    quaternion (with angles here given in radians instead of degrees):
    34+
    The *azim*, *elev*, *roll* rotation order corresponds to rotation of the scene
    35+
    observed by a stationary camera. First, a left-handed rotation about the z axis is
    36+
    applied (*azim*), then a right-handed rotation about the (camera) y axis (*elev*), then a
    37+
    right-handed rotation about the (camera) x axis (*roll*). Here, the z, y, and x axis are fixed
    38+
    axes (not the axes that rotate together with the original scene).
    39+
    40+
    This can also be thought of as orbiting a camera around a fixed scene, by reversing
    41+
    the order of operations. First the camera is rotated about the scene's +x axis
    42+
    (*roll*), then the +y axis (*elev*), then the −z axis (*azim*).
    43+
    44+
    If you would like to make the connection with quaternions (because
    45+
    `Euler angles are horrible <https://github.com/moble/quaternion/wiki/Euler-angles-are-horrible>`_):
    46+
    the *azim*, *elev*, *roll* angles relate to the (intrinsic) rotation of the plot via:
    3647

    3748
    *q* = exp( +roll **** / 2) exp( +elev **ŷ** / 2) exp( −azim **** / 2)
    3849

    39-
    i.e., the angles are a kind of Tait-Bryan angles, −z, +y', +x", rather than
    40-
    classic Euler angles. (If you want to do anything significant with three-dimensional
    41-
    rotations, you are `well advised <https://github.com/moble/quaternion/wiki/Euler-angles-are-horrible>`_
    42-
    to stay clear of Tait-Bryan and Euler angles, and to use quaternions instead.)
    50+
    (with angles given in radians instead of degrees). That is, the angles are a kind of
    51+
    Tait-Bryan angles: −z, +y', +x", rather than classic Euler angles.
    4352

    4453

    4554
    Primary view planes

    doc/users/next_whats_new/view_angles_order.rst

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -12,6 +12,6 @@ For backward compatibility, the old ``elev``, ``azim`` etc. positional arguments
    1212
    will still be accepted (but it is not recommended).
    1313

    1414

    15-
    [1]: See :doc: `/api/toolkits/mplot3d/view_angles` for details. Also, this particular
    15+
    [1]: See :doc:`/api/toolkits/mplot3d/view_angles` for details. Also, this particular
    1616
    order appears to be most common; and it is consistent with the ordering in
    1717
    matplotlib's colors.py - see also :ghissue:`28353`.

    galleries/examples/mplot3d/view_planes_3d.py

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -37,7 +37,7 @@ def annotate_axes(ax, text, fontsize=18):
    3737
    axd[plane].view_init(azim=angles[0], elev=angles[1], roll=angles[2])
    3838
    axd[plane].set_box_aspect(None, zoom=1.25)
    3939

    40-
    label = f'{plane}\n{angles}'
    40+
    label = f'{plane}\nazim={angles[0]}\nelev={angles[1]}\nroll={angles[2]}'
    4141
    annotate_axes(axd[plane], label, fontsize=14)
    4242

    4343
    for plane in ('XY', '-XY'):

    0 commit comments

    Comments
     (0)
    0