Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Description
Documentation Link
https://matplotlib.org/devdocs/users/explain/animations/animations.html#funcanimation
Problem
When looking carefully at the first few frames of the animation from theFuncAnimation
example by settinginterval=2_000
for instance, there are some surprises:
- First, a single point is plotted, corresponding to the initial scatter plot
- Then this point disappears, corresponding to the first frame which is empty because
frame=0
and we take slices (x = t[:frame]
,y = z[:frame]
) - Then the point reappears, and in the following frames the trajectory is plotted as expected
I think the expected behavior is that the first point appears, and then the trajectory starts, which can be obtained by replacingframes=40
withframes=range(2, 40)
.
Side point
That does raise another related point which I encountered and which is what led me to look at that example, which is that saving the animation to a file and showing it in an interactive window behave differently with respect to the first frame. The initial state of the plot is shown in interactive mode but does not show up in the saved GIF. In theFuncAnimation
example, when saving the animation to a GIF, the first frame doesn't have any point, then the point appears and the trajectory then proceeds normally (so it's like I described above but without the first frame).
My understanding is this comes from the fact that the animation does not have access to the initial figure setup, but I might be wrong. This "inconsistency" is a little sad for me because in order to have the first frame show up in the GIF I have to accept the fact that it's shown twice in interactive mode.
Shall I open another issue about this?
Suggested improvement
No response