On Wed, Jul 29, 2009 at 4:38 AM, John Hunter <jdh2358@gmail.com> wrote:
On Wed, Jul 29, 2009 at 1:01 AM, Art<grenander@gmail.com> wrote:
> I have a scatter plot that requires some time to render. The horizontal axis
> is time. Currently, I generate the full scatter plot each time and draw a
> axvline to indicate the progress of time, save the file as a png for each
> time, and generate a movie for all time frames. The scatter plot portion
> doesn't change, just the vertical line.
> I was wondering if there was a way to speed this up, to generate the scatter
> plot once and then overlay it with a moving axvline. I would still have to
> save the png frame by frame, but the most expensive step by far is
> replotting the scatter plot over and over.

This is what the animation/blit api is designed to do:


scipy.org appears down right now, so you may need to try again later.
See also these mpl examples:



Thanks John. That made things more than an order of magnitude faster. It's very impressive.

My bottleneck now is actually saving the pngs for mencoder to make into an avi (as with the movie_demo example on your site) using savefig. Do you also know of an alternative way of generating an avi of the animation? My animation has about 9000 frames.