On Wed, Dec 10, 2008 at 5:20 PM, pierre garrigues <
[EMAIL PROTECTED]> wrote:

>
> # create the initial line
> x = np.linspace(-3, 3, 1000)
> line, = plt.plot(x, np.sin(x), animated=True)
>
> # save the clean slate background -- everything but the animated line
> # is drawn and saved in the pixel buffer background
> background = canvas.copy_from_bbox(ax.bbox)
>

It looks to me that you need to force a figure draw *before* doing
copy_from_bbox.  Eg::

    fig.canvas.draw()
    background = canvas.copy_from_bbox(ax.bbox)

The reason you are seeing a difference between ipython "run" and ipython
copy-and-paste is that in "run" mode ipython turns interactive drawing off
(for details see http://matplotlib.sourceforge.net/users/shell.html) so the
draw event is never called, and the cached renderer, which is triggering
your exception, is never set.

This is speculation, as I haven't tested, so please answer back if this
fixes your problem and if so I will update the matplotlib animation recipe
which also suffers from this problem (which is not exposed unless you are
running in interactive mode, which you are).  It is on my list of things to
do to write a proper animation chapter for the user's guide....

JDH
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to