[SciPy-User] Package recommendations for *efficiently* making good looking animations, or alternatively, how can I "predraw" matplotlib animation frames?

Brian Merchant bhmerchant at gmail.com
Sun Mar 8 17:40:47 EDT 2015


Hi all,

Right now, I am at the simulation stage in my modelling. I need to explore
possible behaviours, in some parameter sets. In order to do this
exploration, it is helpful to visualize the data via animation.

I started with matplotlib, but am disappointed with how long it takes to
produce an animation using my data. It is also difficult for me to navigate
matplotlib's documentation. Anyway, let me explain what I am doing right
now.

Currently, my custom matplotlib animation (i.e. a class that inherit's
from

animation.TimedAnimation) class's `_draw_frame` method does this:

 1. get line data for timestep `n`
 2. update data of each line of interest in the axes with `set_data` (lets
say for the sake of an example (`ax_line1.set_data(datax, datay`, where
`ax_line1, = ax.plot(...)`)
 3. make a list of each line that was updated, and set
`self._drawn_artists` to that (so in the example if two lines of interest
are there, then we update them `self._drawn_artists = [ax_line1, ax_line2]`

Is there a way I can set the data in multiple copies of the line artists
before `_draw_frame` is called? Then, all that `_draw_frame` has to do is
fetch the predrawn lines, and update the drawn artist list with that.

That means that I set the artist data in parallel, if I have the data
already, and thus produce an animation faster? I tried doing
`copy.deepcopy` of the artists, but got an error telling me that I cannot
do so (`TransformationNode` has to be frozen). What other options do I have?

At this point, I am totally open to exploring other packages apart from
matplotlib, that may be recommended.

Kind regards,
Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20150308/c7405740/attachment.html>


More information about the SciPy-User mailing list