本文整理汇总了Python中mpl_toolkits.mplot3d.axes3d.Axes3D方法的典型用法代码示例。如果您正苦于以下问题:Python axes3d.Axes3D方法的具体用法?Python axes3d.Axes3D怎么用?Python axes3d.Axes3D使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mpl_toolkits.mplot3d.axes3d
的用法示例。
在下文中一共展示了axes3d.Axes3D方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from mpl_toolkits.mplot3d import axes3d [as 别名]
# 或者: from mpl_toolkits.mplot3d.axes3d import Axes3D [as 别名]
def __init__(self, quads):
self.quads = quads
self.fig = plt.figure()
self.ax = Axes3D.Axes3D(self.fig)
self.ax.set_xlim3d([-2.0, 2.0])
self.ax.set_xlabel('X')
self.ax.set_ylim3d([-2.0, 2.0])
self.ax.set_ylabel('Y')
self.ax.set_zlim3d([0, 5.0])
self.ax.set_zlabel('Z')
self.ax.set_title('Quadcopter Simulation')
self.init_plot()
self.fig.canvas.mpl_connect('key_press_event', self.keypress_routine)
示例2: animate_vectors
# 需要导入模块: from mpl_toolkits.mplot3d import axes3d [as 别名]
# 或者: from mpl_toolkits.mplot3d.axes3d import Axes3D [as 别名]
def animate_vectors(Exi,Eyi,phase):
# Attaching 3D axis to the figure
E = [Exi, Eyi*np.exp(1.j*phase)]
fig = plt.figure("Polarisation animation")
ax = p3.Axes3D(fig)
k = 2*np.pi / 2
# 100 resultant vectors at various z
z_axis_curve = np.linspace(-2.5,2.5,500)
# t = 0 data, all z
Ex = E[0] * np.exp(1.j*(k*z_axis_curve))
Ey = E[1] * np.exp(1.j*(k*z_axis_curve))
nframes = 100
time = np.linspace(0,4,nframes)
# Creating fifty line objects.
# NOTE: Can't pass empty arrays into 3d version of plot()
curve = ax.plot(Ex, z_axis_curve, Ey, color='k', lw=2)[0]
spokes = 6
lines = [ax.plot([0,Ex[::spokes][i]],[z_axis_curve[::spokes][i],z_axis_curve[::spokes][i]],[0,Ey[::spokes][i]],color='k',alpha=0.3, lw=1)[0] for i in range(len(Ex[::spokes]))]
x_quiver = ax.quiver3D([0],[0],[0],[1],[0],[0],length=2,arrow_length_ratio=0.05,pivot='middle',color='k',lw=2)
y_quiver = ax.quiver3D([0],[0],[0],[0],[0],[1],length=2,arrow_length_ratio=0.05,pivot='middle',color='k',lw=2)
#z_quiver = ax.quiver3D([0],[0],[0],[0],[1],[0],length=5,arrow_length_ratio=0.05,pivot='middle',color='k',lw=2)
k_quiver = ax.quiver3D([0],[0],[0],[0],[1],[0],length=5,arrow_length_ratio=0.05,pivot='middle',color='r',lw=3,alpha=0.6)
ax.text(0, 2.2, 0.15, r"$\vec{k}, \vec{z}$", (0,1,0), color='red', size=18)
ax.text(0.9, 0, 0.1, r"$\vec{x}$", (1,0,0), color='k', size=18)
ax.text(0.1, 0, 0.9, r"$\vec{y}$", (1,0,0), color='k', size=18)
ax.set_xlim3d(-1,1)
ax.set_zlim3d(-1,1)
# Creating the Animation object
line_ani = animation.FuncAnimation(fig, update_lines, nframes, fargs=(Ex, Ey, z_axis_curve,time, curve),
interval=50, blit=False)
plt.show()