當前位置: 首頁>>代碼示例>>Python>>正文


Python axes3d.Axes3D方法代碼示例

本文整理匯總了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) 
開發者ID:abhijitmajumdar,項目名稱:Quadcopter_simulator,代碼行數:15,代碼來源:gui.py

示例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() 
開發者ID:jameskeaveney,項目名稱:ElecSus,代碼行數:49,代碼來源:polarisation_animation_mpl.py


注:本文中的mpl_toolkits.mplot3d.axes3d.Axes3D方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。