Skip to content

[ENH]: Provide axis('equal') for Axes3D. #22570

Closed
@patquem

Description

@patquem

Bug summary

In the example below, I wish to observe a unitary 3D cube in its diagonal axis (1, 1, 1).
azimut and elevation angle should be both 45°, normally.
Why do I need to set elevation = 28° ????
Thanks,
Patrick

Code for reproduction

import numpy as np
import matplotlib.pyplot as plt

fig, ax = plt.subplots(1, 3, figsize=(15, 5),
                       subplot_kw=dict(projection="3d",
                                       proj_type='ortho'))

ax[0].voxels(np.ones((1, 1, 1)), facecolors=[0, 0, 0, 0], edgecolors='k')
ax[0].quiver(0, 0, 0, 1, 1, 1, color='r', linewidth=5)

ax[1].set_title("azim=45°, elev=45°")
ax[1].voxels(np.ones((1, 1, 1)), facecolors=[0, 0, 0, 0], edgecolors='k')
ax[1].view_init(azim=45, elev=45)
ax[1].quiver(0, 0, 0, 1, 1, 1, color='r', linewidth=5)

ax[2].set_title("azim=45°, elev=28°")
ax[2].voxels(np.ones((1, 1, 1)), facecolors=[0, 0, 0, 0], edgecolors='k')
ax[2].view_init(azim=45, elev=28)
ax[2].quiver(0, 0, 0, 1, 1, 1, color='r', linewidth=5)

plt.show()

Actual outcome

image

Expected outcome

view_init(azim=45, elev=45) and not view_init(azim=45, elev=28) to have the expected 3D representation

Additional information

No response

Operating system

Windows

Matplotlib Version

3.4.2

Matplotlib Backend

No response

Python version

Python 3.7.7

Jupyter version

No response

Installation

pip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions