Python-具有matplotlib.pyplot的动画 [英] Python - animation with matplotlib.pyplot

查看:137
本文介绍了Python-具有matplotlib.pyplot的动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用流行的matplotlib库创建动画图?我对GIF动画特别感兴趣.

How can one create animated diagrams using popular matplotlib library? I am particularly interested in animated gifs.

推荐答案

matplotlib文档在动画(请参见此 scipy 教程也).但是,大多数涉及使用各种GUI小部件后端.其中有一个电影演示",展示了如何制作一系列PNGS的AVI.

The matplotlib docs provide an entire section of examples on animation (see this scipy tutorial also). Most, however, involve using the various GUI widget backends. There is one in there, "movie demo", that shows how to produce an avi of a series of PNGS.

要生成动画GIF,我认为您的选择非常有限.最后我检查了 PIL不支持他们.但是,您可以使用pyplot的savefig生成一系列PNG,然后使用对ImageMagick或mencoder的调用将它们缝合在一起.

To produce animated GIFs, I think your options are pretty limited. Last I checked, PIL didn't support them. You could however generate a series of PNGs using pyplot's savefig and then stitch them together using a call to ImageMagick or mencoder.

这篇关于Python-具有matplotlib.pyplot的动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆