I want to make an animation of a drum vibration in python. My problem is that the zero point of the z_axis keeps moving. How can I freeze the z_axis? video link
fig, ax = plt.subplots(subplot_kw={"projection": "3d"})
z=sol[0]
def init():
surf,=ax.plot_surface(xv,yv,z0)
ax.set_xlim(0,1)
ax.set_ylim(0,1)
#ax.set_zlim3d(-1,1)
ax.set_zlim(-1,1)
return surf
def animate(i):
u=add_boundry(z[i+1])
ax.clear()
surf=ax.plot_surface(xv, yv, u)
return surf
anim = FuncAnimation(fig, animate,frames=200, interval=200, blit=False)
anim.save('drum.gif', writer='ffmpeg')