I am trying to embed an inline animation inside a Jupyter notebook. In particular, I want my animation to be indefinite.
In the past I have done this with a while loop recursively updating a plot. I am now trying to use the FuncAnimation
approach.
After writing my animation code I am able to visualize it inline with:
anim = FuncAnimation(
fig, animate, interval=200, init_func=init_plot,frames=10)
HTML(anim.to_html5_video())
This will take some time to generate and then produce an inline animation that is 10 frames.
However, I want an indefinite animation. It seems from the documentation that this should be achievable by omitting the frames
argument. However, when I run this it does not terminate.
This is reasonable that it can't create an HTML video from a non-terminating iteration of frames. However, is there no way to use the FuncAnimation
object to produce an inline, indefinite animation as though I was updating it inside an interactive plt.ion
from a while
loop?