print_figure with animated objects

Hello:

I would like to know how to print_figure or savefig with animated elements. The only thing I get is the axis but no animated objects.

The idea is that I’ve written a program embedding matplotlib in wx and then I create plots and animations in a similar way as in the example animation_blit_wx.py.
In that way, I do something like:

lines, = self.axes.plot(x,y,animated=True)
background = self.canvas.copy_from_bbox(self.figure.bbox)

and afterwards, I create some animation by updating the ydata in the following way:

self.canvas.restore_region(background)
lines.set_ydata(value)
self.axes.draw_artist(lines)
self.canvas.blit(self.figure.bbox)

and now I would like to save the picture:

self.canvas.print_figure(filename, format)

but doing so does not save the lines.
The only workaround I’ve
found is to set animated=false for all the objects, print the figure and then set animated=true again.

Thanks,

Thomas

Yes, that is the way to do it -- we could add some logic to savefig to do this.

JDH

···

On Mon, Jan 5, 2009 at 9:30 AM, <zndlf-web@...1664...> wrote:

but doing so does not save the lines.
The only workaround I've found is to set animated=false for all the objects,
print the figure and then set animated=true again.