Animations - HTML5
We can use html5 for animation, as suggested in this web page: http://louistiao.me/posts/notebooks/embedding-matplotlib-animations-in-jupyter-notebooks/
This seems to be the modern way to do animation in Python.
First step is to initialize some things in Python.
we need %matplotlib inline to get things to plot right on the notebook
we need numpy for the math
se need matplotlib for plotting
we need animation from matplotlib, and HTML from iPython.display to show the animations
We get all these with the following imports:
We now have four steps to get an animated plot
set up the figure frame
define the initializing function
define the function that draws each frame of the animation
call the animator function, which creates all the frames and saves them for you
Then we are ready to call "HTML" to display the animation.
Your browser does not support the video tag.
Anytime you need the animation, you can call it up at will, with the following code:
Last updated