Relative Content

Tag Archive for pythonpython-3.xmatplotlibjupyter-notebookmatplotlib-animation

Matplotlib animation script runs fine first time but gets stuck on re-runs until kernel is restarted

I’m trying to run an animation where a scatter plot is updated every timestep. I am working in a jupyter notebook in vscode (if relevant). The animation script, given below, runs great the first time but it doesn’t execute as intended on subsequent runs. The problem is only fixed when I restart the kernel. My work requires me to constantly modify this animation code and hence need to rerun it multiple times. Restarting the kernel every time is cumbersome.