Feature Request: non-square axes in axes3D · Issue #8593 · matplotlib/matplotlib · GitHub
Skip to content

Feature Request: non-square axes in axes3D #8593

Description

@huangziwei

Currently, we can get non-square axes in axes3D based on a simple hack from http://stackoverflow.com/a/10328142/2135095, by editing the get_proj function inside site-packages\mpl_toolkits\mplot3d\axes3d.py:

def get_proj(self):

    relev, razim = np.pi * self.elev/180, np.pi * self.azim/180

    try:
        self.localPbAspect = self.pbaspect
    except AttributeError:
        self.localPbAspect = [1,1,1]
    
    xmin, xmax = self.get_xlim3d() / self.localPbAspect[0]
    ymin, ymax = self.get_ylim3d() / self.localPbAspect[1]
    zmin, zmax = self.get_zlim3d() / self.localPbAspect[2]

then in the code we can set the axes manually:

fig = plt.figure()
ax = fig.gca(projection='3d')
ax.pbaspect = [1,1,0.5]

it would be great if we can have some generic solution to achieve non-square axes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions