Switch to jshtml to render animations

main
Aurélien Geron 2020-04-20 10:51:33 +12:00
parent d46228a6af
commit 5fcf4bdb16
1 changed files with 5 additions and 4 deletions

View File

@ -1087,8 +1087,8 @@
},
"outputs": [],
"source": [
"%matplotlib nbagg\n",
"import matplotlib.animation as animation"
"import matplotlib.animation as animation\n",
"matplotlib.rc('animation', html='jshtml')"
]
},
{
@ -1125,7 +1125,8 @@
" return line,\n",
"\n",
"line_ani = animation.FuncAnimation(fig, update_line, frames=100, fargs=(data, line), interval=67)\n",
"plt.show()"
"plt.close()\n",
"line_ani"
]
},
{
@ -1133,7 +1134,7 @@
"metadata": {},
"source": [
"# Saving animations to video files\n",
"Matplotlib relies on 3rd-party libraries to write videos such as [FFMPEG](https://www.ffmpeg.org/) or `mencoder`. In this example we will be using FFMPEG so be sure to install it first."
"Matplotlib relies on 3rd-party libraries to write videos such as [FFMPEG](https://www.ffmpeg.org/) or [ImageMagick](https://imagemagick.org/). In this example we will be using FFMPEG so be sure to install it first. To save the animation to the GIF format, you would need ImageMagick."
]
},
{