-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Open
Description
Bug summary
I noticed this behaviour few days ago. I'm not very familiar with matplotlib so this might be user error, but it's really strange and unexpected.
Code for reproduction
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib.collections import LineCollection
import numpy as np
fig, ax = plt.subplots()
dots = []
def init():
plt.cla()
ax.set_xlim(-1, 3)
ax.set_ylim(-1, 2)
global dots
# Initialize vertices
dot1, = ax.plot([0], [0], 'o', color='red')
dot2, = ax.plot([0], [1], 'o', color='green')
dots = [dot1, dot2]
return sum([dots], [])
def animate(frame_index):
for k, dot in enumerate(dots):
y = (frame_index % 15) / 15
dot.set_data([[k], [y]])
return sum([dots], [])
ani = animation.FuncAnimation(fig, animate, frames=15, init_func=init, blit=True)
plt.show()
Actual outcome
When I move the camera using the move tool during the animation, last frame of the old animation seems to linger in some sort of buffer, until the camera is moved again.
Here, the top two dots are from the old animation loop, and the two bottom ones are from the new animation loop.
Expected outcome
I would not expect old frames to be kept anywhere, period.
Additional information
No response
Operating system
No response
Matplotlib Version
3.8.4
Matplotlib Backend
No response
Python version
Python 3.10.4
Jupyter version
No response
Installation
None
Metadata
Metadata
Assignees
Labels
No labels