22

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

askedMar 30, 2010 at 16:16
psihodelia's user avatar

2 Answers2

23

The matplotlib docs provide an entire section of examples onanimation (see thisscipy 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.

To produce animated GIFs, I think your options arepretty 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.

Mike T's user avatar
Mike T
44.4k18 gold badges166 silver badges213 bronze badges
answeredMar 30, 2010 at 18:28
Mark's user avatar
Sign up to request clarification or add additional context in comments.

Comments

6

Update in 2017

Matplotlib has theanimation module, and in it you find theImageMagickFileWriter class. It is advertised as "File-based animatedgif writer."

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

answeredFeb 10, 2017 at 14:08
Unapiedra's user avatar

Comments

Your Answer

Sign up orlog in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

By clicking “Post Your Answer”, you agree to ourterms of service and acknowledge you have read ourprivacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.