我试图使用matplotlib.到目前为止,这是我的方法:import numpy as npimport matplotlib.pyplot as pltfrom mpl_toolkits.mplot3d import Axes3Dn = 100# theta: poloidal angle; phi: toroidal angletheta = np.linspace(0, 2.*np.pi, n)phi = np.linspace(0, 2.*np.pi, n)theta, phi = np.meshgrid(theta, phi)# R0: major radius; a: minor radiusR0, a = 2., 1.# torus parametrizationx = (R0 + a*np.cos(theta)) * np.cos(phi)y = (R0 + a*np.cos(theta)) * np.sin(phi)z = a * np.sin(theta)# "cut-off" half of the torusx[x>0] = np.nanfig = plt.figure()ax1 = fig.add_subplot(111, projection='3d')ax1.set_zlim(-3,3)ax1.plot_surface(x, y, z, rstride=5, cstride=5,)# elev: elevation angle in z-plane# azim: azimuth angle in x,y planeax1.view_init(elev=15, azim=0)plt.show()这样做,确实给了我半个圆环,但其中一个切割面不清楚,如图所示任何想法如何制作干净的切割表面?
添加回答
举报
0/150
提交
取消