All, I have:
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
import numpy as np
fig=plt.figure()
ax=axes3d.Axes3D(fig)
x=np.linspace(-2,2,40)
y=np.linspace(-2,2,40)
X, Y=np.meshgrid(x,y)
Z=6-2*X**2
ax.plot_wireframe(X,Y,Z)
ax.set_xlabel('x-axis')
ax.set_ylabel('y-axis')
ax.set_zlabel('z-axis')
plt.show()
How can I add a title and rotate the axes?
D.
Hello,
The Axes3D constructor accepts the keywords "azim" and "elev" to set the viewpoint of the figure.
As for the title, I could not find information in the examples or the api, so I suggest to add text with the text method. This solution lacks an automatic placement for the title, however.
I give an example in your code:
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
import numpy as np
fig=plt.figure()
ax=axes3d.Axes3D(fig,azim=120)
x=np.linspace(-2,2,40)
y=np.linspace(-2,2,40)
X, Y=np.meshgrid(x,y)
Z=6-2*X**2
ax.plot_wireframe(X,Y,Z)
ax.set_xlabel('x-axis')
ax.set_ylabel('y-axis')
ax.set_zlabel('z-axis')
ax.text(0,0,9,'My Title')
plt.show()
···
Le 7 déc. 09 à 01:39, David Arnold a écrit :
All, I have:
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
import numpy as np
fig=plt.figure()
ax=axes3d.Axes3D(fig)
x=np.linspace(-2,2,40)
y=np.linspace(-2,2,40)
X, Y=np.meshgrid(x,y)
Z=6-2*X**2
ax.plot_wireframe(X,Y,Z)
ax.set_xlabel('x-axis')
ax.set_ylabel('y-axis')
ax.set_zlabel('z-axis')
plt.show()
How can I add a title and rotate the axes?
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
matplotlib-users List Signup and Options