animation.ArtistAnimation函数
复制代码1
2
3ani = animation.ArtistAnimation(fig, lns, interval=50) #生成动画 ani.save("pendulum.gif", writer='pillow') ani.save('Pendulum_Animation.mp4',writer='ffmpeg',fps=1000/50)
fig是用来展示的figure,用plt.figure()生成
lns是list格式,每一个元素是一个完全由artists 类组成的collection ,代表一帧,并且只在这一帧显示(过了这一帧会被擦除)
interval是每一帧之间的间隔
https://github.com/skyerhxx/Pendulum
最后
以上就是安静含羞草最近收集整理的关于Python绘制动画并保存为gif/mp4 (matplotlib)的全部内容,更多相关Python绘制动画并保存为gif/mp4内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复