I believe I've found a problem with the following cookbook example: http://www.scipy.org/Cookbook/Matplotlib/Animations?action=show#head-3d51654b8306b1585664e7fe060a60fc76e5aa08 .  Specifically, the example calls canvas.copy_from_bbox() before the initial draw().  This doesn't throw an error, but will result in unexpected behavior (I spent an embarrassing amount of time debugging the resulting confusion in my own code).

The solution I came up with to fix the issue is to structure the code as follows:

...set up plot...
background = None

def animate(*args):
    global background
    if background is None:
        background = canvas.copy_from_bbox(ax.bbox)
    ...rest of animation...


This works, but I dislike it for two reasons: I have to use a global variable, and there is an extra conditional test in every call to the animation function.  Obviously neither flaw is terribly serious, but I was wondering if there is a better / accepted way of handling this.  Or, am I just completely off-base on this whole issue -- I'm new to matplotlib, still figuring things out.

Drew Frank