途中までうまくいっていたのですが、エラーがでるようになってしまいました。
python
1import numpy as np 2import matplotlib.pyplot as plt 3import matplotlib.animation as animation 4 5fig = plt.figure() 6x = np.arange(0, 10, 0.1) 7 8ims = [] 9for a in range(50): 10 y = np.sin(x - a) 11 im = plt.plot(x, y, "b") 12 ims.append(im) 13 14ani = animation.ArtistAnimation(fig, ims) 15ani.save('sample.gif', writer='imagemagick')
エラーはこちらです
AttributeError Traceback (most recent call last)
/Users/~~~/sample.py in <module>()
13
14 ani = animation.ArtistAnimation(fig, ims)
---> 15 ani.save('sample.gif', writer='imagemagick')
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/animation.pyc in save(self, filename, writer, fps, dpi, codec, bitrate, extra_args, metadata, extra_anim, savefig_kwargs)
724 # since GUI widgets are gone. Either need to remove extra code to
725 # allow for this non-existant use case or find a way to make it work.
--> 726 with writer.saving(self._fig, filename, dpi):
727 for data in itertools.izip(*[a.new_saved_frame_seq()
728 for a in all_anim]):
AttributeError: 'str' object has no attribute 'saving'
ちなみに、matplotlibrcの最後の行には以下のように記述しています
animation.convert_path: C:\Program Files\ImageMagick-6.9.2-Q16\magick.exe
matplotlib backend: TkAggのもとで操作しています。
環境は
macos yosemite 10.10.5
python 2.7.10
matplotlib 10.10.5
です。
追記
どうやら ani.save("demo.mp4")
としてもエラーはでないのですが、保存がされないようです。
ffmpegあたりの問題でしょうか...
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。