Re: [Matplotlib-users] problem with patches in animation

2014-04-23 Thread Benjamin Root
https://github.com/WeatherGod/BRadar in scripts/, there is radarmovie.py which I create a few subclasses of FuncAnimation, which was to solve a modularity issue I was having (I needed self-contained animation classes that I could use pieces of elsewhere, but still be able to join them all together

Re: [Matplotlib-users] problem with patches in animation

2014-04-23 Thread Mark Bakker
Raymond, The documentation says: If blit=True, *func* and *init_func* should return an iterable of drawables to clear. But clearly, whatever is set by init_func is not cleared during animation when blit=True, while it is cleared when blit=False. Unless anybody knows what I am doing wrong I will

Re: [Matplotlib-users] problem with patches in animation

2014-04-23 Thread Mark Bakker
Benjamin, I don't mind doing classes to store the state, but isn't a Patch already a class? Do you know of an example online that I can work off? Thanks for your suggestions, Mark On Wed, Apr 23, 2014 at 5:12 PM, Benjamin Root wrote: > I think it is because the figure may or may not have som

Re: [Matplotlib-users] problem with patches in animation

2014-04-23 Thread Benjamin Root
I think it is because the figure may or may not have some things drawn by the time the blitting starts. This is due to draw_idle(). So, it is trying to capture whatever is in the figure's canvas, but drawing may or may not have happened yet. Try this: def animate(i): if not animate.patch:

Re: [Matplotlib-users] problem with patches in animation

2014-04-23 Thread Raymond Smith
This is pretty weird. If instead of Mark's original script, if I move the add_patch out of init and have the init simply return an empty tuple, it _mostly_ works as expected. But -- at least on my computer -- on some runs, it has the moving circle, but also leaves a circle at the "top", starting po

Re: [Matplotlib-users] problem with patches in animation

2014-04-23 Thread Benjamin Root
Working off of very faded memory, try not to return any objects in your init function that you intend to be animated. If I remember correctly, when blitting is True, the animator treats any object returned by the init() function as background objects, and any objects returned by the animation funct

Re: [Matplotlib-users] problem with patches in animation

2014-04-23 Thread Raymond Smith
Well, the intended behavior of init() isn't completely clear to me after reading over some of the docs and examples , so I'm not sure if it's a bug or not. Either way, it could be a request for documentation,

Re: [Matplotlib-users] problem with patches in animation

2014-04-23 Thread Mark Bakker
I thought about that. I even thought about changing the initial color to white or radius to zero. But I am thinking this is a bug. When blitting, whatever is created with the init function is not removed. That is why lines that are animated initially have no data. For a Patch object this is a bit

Re: [Matplotlib-users] problem with patches in animation

2014-04-23 Thread Raymond Smith
Hi Mark, I can't say this is the 'proper' solution or the correct interpretation, but it should work. I think when blitting that the init function serves as a something of a "background" for the rest of the animation. So try changing def init(): *patch.center = (5, 5)* ax.add_patch(patch

[Matplotlib-users] problem with patches in animation

2014-04-23 Thread Mark Bakker
Hello list, I am trying to animate a patch. The animation should show a circle orbiting around a point. I took the code from http://nickcharlton.net/posts/drawing-animating-shapes-matplotlib.html Problem is that when I run the code, the animation doesn't remove the initial position of the circle