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": [], "outputs": [],
"source": [ "source": [
"%matplotlib nbagg\n", "import matplotlib.animation as animation\n",
"import matplotlib.animation as animation" "matplotlib.rc('animation', html='jshtml')"
] ]
}, },
{ {
@ -1125,7 +1125,8 @@
" return line,\n", " return line,\n",
"\n", "\n",
"line_ani = animation.FuncAnimation(fig, update_line, frames=100, fargs=(data, line), interval=67)\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": {}, "metadata": {},
"source": [ "source": [
"# Saving animations to video files\n", "# 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."
] ]
}, },
{ {