from mpl_toolkits import mplot3d
from mpl_toolkits.mplot3d import axes3d
%matplotlib qt
# Create the figure
fig=plt.figure()
# Add an axes
ax = fig.add_subplot(111, projection='3d')
# plot the surface
# create x,y
xx, yy = np.meshgrid(np.min(z2[:,4]) + ((np.max(z2[:,4])-np.min(z2[:,4]))/9)*range(10),
np.min(z2[:,2]) + ((np.max(z2[:,2])-np.min(z2[:,2]))/9)*range(10))
# calculate corresponding z
z = np.zeros((10,10))
ax.plot_surface(xx, yy, z, alpha=0.8, color='g')
# add the trajectory
ax.plot3D(z2[:,4],
z2[:,2],
z2[:,0])
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_zlabel('z')
ax.view_init(30, 0)
fig;
plt.draw()
我尝试使用matplotlib 3d动画,但出现了一些错误。我似乎无法让我的代码遵循matplotlib编写的示例。使用matplotlib 3d动画对此进行动画处理的任何帮助都将很棒。