代码之家  ›  专栏  ›  技术社区  ›  psihodelia

Python-带matplotlib.pyplot的动画

  •  21
  • psihodelia  · 技术社区  · 15 年前

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

    3 回复  |  直到 15 年前
        1
  •  24
  •   Mike T    6 年前

    matplotlib文档提供了关于 animation scipy 教程)。然而,大多数涉及使用各种GUI小部件后端。有一个在那里,“电影演示”,展示了如何产生一系列PNG的avi。

    要制作动画gif,我认为你的选择是 pretty limited . 上次我查的时候, PIL didn't support them

        2
  •  14
  •   Heberto Mayorquin    11 年前

    这个问题有点老了,不过我还是会回答,以防有人在这里撞车,这可能是有用的。

    所以现在看来,使用matplotlib最好的方法是使用它们提供的功能:

    http://matplotlib.org/api/animation_api.html#module-matplotlib.animation

    它们还包括一些有用的示例,您可以根据需要轻松修改这些示例(不过,如果您没有以面向类的方式使用matplotlib,则很难理解它们的工作原理):

    http://matplotlib.org/examples/animation/

    最后,为了补充这些信息,Jake VanderPlas提供了一个更完整的教程,并简要回顾了Python可视化的未来:

    http://jakevdp.github.io/blog/2012/08/18/matplotlib-animation-tutorial/

    http://jakevdp.github.io/blog/2013/03/23/matplotlib-and-the-future-of-visualization-in-python/

        3
  •  6
  •   Unapiedra    8 年前

    2017年更新

    动画 模块,在其中您可以找到 ImageMagickFileWriter “作者。”

    http://matplotlib.org/api/_as_gen/matplotlib.animation.ImageMagickFileWriter.html#matplotlib.animation.ImageMagickFileWriter