Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Closed
Labels
Description
Bug report
Bug summary
I am unable to save an animation using ffmpeg.
Code for reproduction
importmatplotlibimportmatplotlib.pyplotaspltfrommatplotlib.animationimportFuncAnimationx= []y= []Writer=matplotlib.animation.writers['ffmpeg']writer=Writer(fps=15,metadata=dict(artist='Me'),bitrate=1800)fig=plt.figure()ax=fig.add_subplot(111)ax.set_xlim(0,500)ax.set_ylim(0,1000)line,=ax.plot(0,0,'r')defAnimationFrame(i):x.append(i)y.append(i**1.5)line.set_xdata(x)line.set_ydata(y)returnline,animation=FuncAnimation(fig,func=AnimationFrame,frames=range(0,200),interval=100)plt.show()animation.save('im.mp4',writer=writer)
Actual outcome
Traceback (most recent call last): File "pypy.py", line 27, in <module> animation.save('im.mp4', writer=writer) File "C:\Users\yongj\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\matplotlib\animation.py", line 1156, in save writer.grab_frame(**savefig_kwargs) File "C:\Users\yongj\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\matplotlib\animation.py", line 380, in grab_frame self.fig.set_size_inches(self._w, self._h) File "C:\Users\yongj\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\matplotlib\figure.py", line 912, in set_size_inches manager.resize(int(canvasw), int(canvash)) File "C:\Users\yongj\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\matplotlib\backends\_backend_tk.py", line 532, in resize self.canvas._tkcanvas.master.geometry("%dx%d" % (width, height)) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.752.0_x64__qbz5n2kfra8p0\lib\tkinter\__init__.py", line 2035, in wm_geometry return self.tk.call('wm', 'geometry', self._w, newGeometry)_tkinter.TclError: can't invoke "wm" command: application has been destroyed
installed matplotlib using pip