Title: Unable to save animation · Issue #16713 · matplotlib/matplotlib · GitHub
Open Graph Title: Unable to save animation · Issue #16713 · matplotlib/matplotlib
X Title: Unable to save animation · Issue #16713 · matplotlib/matplotlib
Description: Bug report Bug summary I am unable to save an animation using ffmpeg. Code for reproduction import matplotlib import matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation x = [] y = [] Writer = matplotlib.animation.writ...
Open Graph Description: Bug report Bug summary I am unable to save an animation using ffmpeg. Code for reproduction import matplotlib import matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation x = [] y...
X Description: Bug report Bug summary I am unable to save an animation using ffmpeg. Code for reproduction import matplotlib import matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation x = [] y...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/16713
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Unable to save animation","articleBody":"### Bug report\r\n\r\n**Bug summary**\r\n\r\nI am unable to save an animation using ffmpeg. \r\n\u003c!--A short 1-2 sentences that succinctly describes the bug--\u003e\r\n\r\n**Code for reproduction**\r\n\r\n\u003c!--A minimum code snippet required to reproduce the bug.\r\nPlease make sure to minimize the number of dependencies required, and provide\r\nany necessary plotted data.\r\nAvoid using threads, as Matplotlib is (explicitly) not thread-safe.--\u003e\r\n\r\n```python\r\nimport matplotlib\r\nimport matplotlib.pyplot as plt\r\nfrom matplotlib.animation import FuncAnimation\r\n \r\nx = []\r\ny = []\r\n\r\nWriter = matplotlib.animation.writers['ffmpeg']\r\nwriter = Writer(fps=15, metadata=dict(artist='Me'), bitrate=1800)\r\n\r\nfig = plt.figure()\r\nax = fig.add_subplot(111)\r\nax.set_xlim(0,500)\r\nax.set_ylim(0,1000)\r\nline, = ax.plot(0,0,'r')\r\n\r\n\r\ndef AnimationFrame(i):\r\n x.append(i)\r\n y.append(i ** 1.5) \r\n line.set_xdata(x)\r\n line.set_ydata(y)\r\n return line,\r\nanimation = FuncAnimation(fig, func=AnimationFrame, frames=range(0,200), interval = 100)\r\n\r\nplt.show()\r\nanimation.save('im.mp4', writer=writer)\r\n```\r\n\r\n**Actual outcome**\r\n\r\n\u003c!--The output produced by the above code, which may be a screenshot, console output, etc.--\u003e\r\n\r\n```\r\nTraceback (most recent call last):\r\n File \"pypy.py\", line 27, in \u003cmodule\u003e\r\n animation.save('im.mp4', writer=writer)\r\n 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\r\n writer.grab_frame(**savefig_kwargs)\r\n 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\r\n self.fig.set_size_inches(self._w, self._h)\r\n 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\r\n manager.resize(int(canvasw), int(canvash))\r\n 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\r\n self.canvas._tkcanvas.master.geometry(\"%dx%d\" % (width, height))\r\n File \"C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.8_3.8.752.0_x64__qbz5n2kfra8p0\\lib\\tkinter\\__init__.py\", line 2035, in wm_geometry\r\n return self.tk.call('wm', 'geometry', self._w, newGeometry)\r\n_tkinter.TclError: can't invoke \"wm\" command: application has been destroyed\r\n\r\n```\r\n\r\n\r\n\u003c!--Please tell us how you installed matplotlib and python e.g., from source, pip, conda--\u003e\r\ninstalled matplotlib using pip\r\n\u003c!--If you installed from conda, please specify which channel you used if not the default--\u003e\r\n\r\n","author":{"url":"https://github.com/khoo0157","@type":"Person","name":"khoo0157"},"datePublished":"2020-03-09T16:58:01.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/16713/matplotlib/issues/16713"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f5d093e2-a6f5-b161-c974-fee39b8583d5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C7C6:33585E:7A274C:B11989:6A55ECD1 |
| html-safe-nonce | d486d64639a57ae85df67ae370f50dd0ea1679f46b69a82c9c7af21fa739bd8a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDN0M2OjMzNTg1RTo3QTI3NEM6QjExOTg5OjZBNTVFQ0QxIiwidmlzaXRvcl9pZCI6Ijc2NTc4MjMzNDkzNDM5MDcwMjUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 4e7f14d0b8f5e5c0d9bd6e044cae2f74d537a1869728413b18be08c445482745 |
| hovercard-subject-tag | issue:578051722 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/16713/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6f64af09148e7fcafc5fa916e5c575d376dcc299b9763e7cdf4d6cae9d08aeb8/matplotlib/matplotlib/issues/16713 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6f64af09148e7fcafc5fa916e5c575d376dcc299b9763e7cdf4d6cae9d08aeb8/matplotlib/matplotlib/issues/16713 |
| og:image:alt | Bug report Bug summary I am unable to save an animation using ffmpeg. Code for reproduction import matplotlib import matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation x = [] y... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | khoo0157 |
| hostname | github.com |
| expected-hostname | github.com |
| None | b5665c84831ed9ac4fb79519c16c9c5580ba8092fb8bb6e3e72972ec7197348e |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3725c7f9b2a6e3a27ef57c5aed13428c0f65e045 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width