請參閱下麵的示例代碼,使用displayHTML (ani.to_jshtml ())執行matplotlib動畫磚的筆記本
進口matplotlib。pyplot plt matplotlib進口。動畫導入numpy np t = np.linspace (0, 2 * np.pi) x = np.sin (t)無花果、ax = plt.subplots () l = ax.plot ([0, 2 * np.pi],[1])動畫=λ我:l。set_data x (t[我],[我])ani = matplotlib.animation。FuncAnimation(圖、動畫幀= len (t)) plt.show () displayHTML (ani.to_jshtml ())
請參閱下麵的示例代碼,使用displayHTML (ani.to_jshtml ())執行matplotlib動畫磚的筆記本
進口matplotlib。pyplot plt matplotlib進口。動畫導入numpy np t = np.linspace (0, 2 * np.pi) x = np.sin (t)無花果、ax = plt.subplots () l = ax.plot ([0, 2 * np.pi],[1])動畫=λ我:l。set_data x (t[我],[我])ani = matplotlib.animation。FuncAnimation(圖、動畫幀= len (t)) plt.show () displayHTML (ani.to_jshtml ())