axis equal

All,

Is there an "axis equal" command for mplot3d?

D.

Unfortunately i have not found such a function as of yet and the function
that sound close to it (aspect) only controls the windows aspect ratio

Fortunately there is a quick and dirty work around

I have found the following to be useful

Assuming you have X Y Z matrices made using meshgrid or some other means

from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np

fig = plt.figure()
ax = Axes3D(fig)

u = np.linspace(0, 2 * np.pi, 100)
v = np.linspace(0, np.pi, 100)

x = 10 * np.outer(np.cos(u), np.sin(v))
y = 10 * np.outer(np.sin(u), np.sin(v))
z = 50 * np.outer(np.ones(np.size(u)), np.cos(v))
ax.plot_surface(x, y, z, rstride=4, cstride=4, color='b')

Xstart=(x.min())
Xend =(x.max())

Ystart=(y.min())
Zstart=(z.min())

Scalex=(Xend-Xstart)

ax.set_xlim3d(Xstart,Xstart+Scale)
ax.set_ylim3d(Ystart,Ystart+Scale)
ax.set_zlim3d(Zstart,Zstart+Scale)

plt.show()

again I have made the assumption that the plot is "squarish" in the x and y
direction, a more robust version would test to see which is the biggest
scalex,scaley,scalez center the other axis value but again i just coded this
in 5 min as an example

···

-----Original Message-----
From: David Arnold [mailto:dwarnold45@…2108…]
Sent: December-07-09 12:30 PM
To: matplotlib-users@lists.sourceforge.net
Subject: [Matplotlib-users] axis equal

All,

Is there an "axis equal" command for mplot3d?

D.

----------------------------------------------------------------------------
--
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing.
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users