A "quick afternoon hack" developed into what seems to me to be a
useful and simple framework for doing animations in matplotlib,
utilizing the timed idle event in GTK (currently). It also supports
writing out a movie file using ffmpeg. Particular issues:
1) Supporting backends other than gtk. I'm not sure how to mimic the
behavior of gobject.idle_add() with Qt and Wx. Also, I'm not sure if
code to mimic this belongs with the animation class or should be kept
with the backend to allow use elsewhere.
2) The FuncAnimation class is written to allow an easy way to make a
more "procedural" animation, such as one that displays data while
reading from a live source, or draws a line repeatedly adding the
points. My question is whether the interface makes sense or if it's
even worthwhile since it's just saving a couple lines of code that
would be necessary to just to a straightforward Animation subclass.
The code still needs quite a bit of clean up and thought to make sure
that the classes are broken up into the proper parts, as well as
documentation, but I wanted to see if this seems like a good way to go
to add easy animation support to matplotlib.
animation.py (4.9 KB)
Graduate Research Assistant
School of Meteorology
University of Oklahoma