On Mon, Aug 23, 2010 at 7:59 AM, Kim Hansen <[email protected]> wrote:
> Hi list,
>
> I am using animated artists to generate an animation, where I save each step
> in the anmantion as a png using the savefig method of the figure instance
> after drawing the animated artists on a cached background and after
> fig.canvas.blit.
>
> What I see on screen are the updated animated artists being drawn, but only
> the cached background with subplots and axes and grid is being stored in the
> savefig commands
> called after the last blit.
>
> Why is only the background saved.?
The animated property tells the figure to not draw the artist on a
call to figure.draw, which is wha savefig calls. This enables you to
draw the background (everything but the animated artists) with a call
to figure.canvas.draw, and then selectively draw your animated artists
when you want. It does pose a problem for saving.
The best approach is to turn off the animated property right before
saving, and turn it back on as needed. Something like
artists = fig.get_children()
animated = dict()
for artist in artists:
animated[artist] = artist.get_animated()
artist.set_animated(False)
fig.savefig('myfig.png')
for artist in artists:
artist.set_animated(animated[artist])
Also, Ryan May has been working on a nice framework for animation that may help,
http://github.com/dopplershift/Animation
JDH
------------------------------------------------------------------------------
This SF.net email is sponsored by
Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users