Embedding Matplotlib Animations in Jupyter Notebooks
In his blog post Embedding Matplotlib Animations in IPython Notebooks, Jake VanderPlas presents a slick hack for embedding Matplotlib Animations in IPython Notebooks, which involves writing it as a video to a tempfile, and then re-encoding it in Base64 as a HTML5 Video.
Unfortunately (or rather fortunately), this hack has been largely rendered obsolete by the heavy development efforts dedicated to both Matplotlib and IPython Notebook (since renamed to Jupyter Notebook) in recent years. In particular, Matplotlib 1.5.1 now supports inline display of animations in the notebook with the
to_html5_video method, which converts the animation to an h264 encoded video and embeddeds it directly in the notebook.
In this notebook, we reproduce Jake VanderPlas' blog post with this new feature.