Q&A
pjupyter notebook を使ってgif(またはmp4)アニメーションを保存したいです。
現在、インライン?でアニメーションの再生はできますが、保存をさせるとエラーが出ます。
よろしくお願いします。
環境は、
mac book pro
python3.6.0
jupyter notebook
です。
python3
1%matplotlib nbagg 2 3import numpy as np 4import matplotlib.pyplot as plt 5import matplotlib.animation as animation 6 7fig = plt.figure() 8x = np.arange(0, 10, 0.1) 9 10ims = [] 11for a in range(50): 12 y = np.sin(x - a) 13 im = plt.plot(x, y, "r") 14 ims.append(im) 15 16ani = animation.ArtistAnimation(fig, ims) 17ani.save('sample_gif.gif', writer='imagemagick') 18plt.show() 19
ani.save('sample_gif.gif', writer='imagemagick')
の部分がアニメーションの保存になっています。
matplotlib>に寄れば、ターミナル上で
brew install imagemagick
とすれば良いとありました。
そこでこれを実行したのですが、同様にエラーが出ました。
エラーは以下です。
error
1Traceback (most recent call last): 2 File "/Users/****/.pyenv/versions/anaconda3-4.3.1/envs/py3.6.0/lib/python3.6/site-packages/matplotlib/cbook/__init__.py", line 388, in process 3 proxy(*args, **kwargs) 4 File "/Users/****/.pyenv/versions/anaconda3-4.3.1/envs/py3.6.0/lib/python3.6/site-packages/matplotlib/cbook/__init__.py", line 228, in __call__ 5 return mtd(*args, **kwargs) 6 File "/Users/****/.pyenv/versions/anaconda3-4.3.1/envs/py3.6.0/lib/python3.6/site-packages/matplotlib/animation.py", line 1499, in _stop 7 self.event_source.remove_callback(self._loop_delay) 8AttributeError: 'NoneType' object has no attribute 'remove_callback'
何が原因なのでしょうか。よろしくお願い致します。
回答1件
あなたの回答
tips
プレビュー
下記のような回答は推奨されていません。
このような回答には修正を依頼しましょう。