【发布时间】:2020-04-23 10:31:53
【问题描述】:
我正在尝试在没有超出比例或覆盖主图的情况下在图上绘制平面。理想情况下,我想要的是在波函数的复杂可视化中帮助潜在障碍的可视化,这可以通过在势能区域之间以某种方式创建阴影体积来完成......我想我可以为此制作两个平面但他们被策划让我看不见我的主要情节。这是我在没有和分别尝试过的飞机的情况下得到的图的两张图片:
我想我可能覆盖了主情节,但我找不到解决这个问题的明确方法,这是我用来制作情节和动画的代码(如果需要,我可以分享整个代码) :
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.animation as animation
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.gca(projection='3d')
ax.get_proj = lambda: np.dot(Axes3D.get_proj(ax), np.diag([1.5, 0.7, 0.7, 1]))
line,=ax.plot(x,IMAG[0,:],REAL[0,:],"r",linewidth=0.5)
ax.set_xlabel('Posició (nm)')
ax.set_ylabel('$Im[\psi(x,t)]$')
ax.set_zlabel('$Re[\psi(x,t)]$')
#Here are the two planes
yy, zz = np.meshgrid(range(-2,2), range(-2,2))
ax2 = plt.subplot(projection='3d')
ax2.plot_surface(-l, yy, zz,color='b',alpha=0.2)
ax2.plot_surface(l, yy, zz,color='b',alpha=0.2)
def animacio(i):
ax.collections.clear()
line.set_data(REAL[i,:],IMAG[i,:])
line.set_3d_properties(x, 'x')
return line,
ani=animation.FuncAnimation(fig,animacio,interval=50, frames=Nt,repeat=True)
ani.save(f'Evolució_[{V0},{L},{l},{xi},{sigmax},{T}].mp4', writer="ffmpeg", dpi=300)
plt.show()
【问题讨论】:
标签: python matplotlib animation plot data-visualization