Title: Crash when interactively adding a number of subplots · Issue #11123 · matplotlib/matplotlib · GitHub
Open Graph Title: Crash when interactively adding a number of subplots · Issue #11123 · matplotlib/matplotlib
X Title: Crash when interactively adding a number of subplots · Issue #11123 · matplotlib/matplotlib
Description: Bug report Bug summary Adding subplots repeatedly to a figure in interactive mode can sometimes crash Matplotlib version 2.2.2, in version 2.0.2 everything works. Sometimes it does not crash, but when you resize figure's window to make i...
Open Graph Description: Bug report Bug summary Adding subplots repeatedly to a figure in interactive mode can sometimes crash Matplotlib version 2.2.2, in version 2.0.2 everything works. Sometimes it does not crash, but w...
X Description: Bug report Bug summary Adding subplots repeatedly to a figure in interactive mode can sometimes crash Matplotlib version 2.2.2, in version 2.0.2 everything works. Sometimes it does not crash, but w...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/11123
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Crash when interactively adding a number of subplots","articleBody":"\u003c!--To help us understand and resolve your issue, please fill out the form to the best of your ability.--\u003e\r\n\u003c!--You can feel free to delete the sections that do not apply.--\u003e\r\n\r\n### Bug report\r\n\r\n**Bug summary**\r\n\r\nAdding subplots repeatedly to a figure in interactive mode can sometimes crash Matplotlib version 2.2.2, in version 2.0.2 everything works. Sometimes it does not crash, but when you resize figure's window to make it significantly smaller it crashes every time. I'm using Matplotlib on Kubuntu 16.04 64 bit with Python 3.5.2.\r\n\r\n**Code for reproduction**\r\n\r\n\u003c!--A minimum code snippet required to reproduce the bug, also minimizing the number of dependencies required--\u003e\r\n\r\n```python\r\nimport matplotlib.pyplot as plt\r\nimport time\r\n\r\nplt.ion()\r\n\r\ndef test_subplot_crash_with_matplotlib222():\r\n plt.ion()\r\n\r\n import matplotlib\r\n print(\"Matplotlib ver\", matplotlib.__version__)\r\n fig = plt.figure()\r\n fig.set_size_inches(10, 10)\r\n for i in range(100):\r\n ax = fig.add_subplot(10, 10, i+1)\r\n ax.plot([0, 1], [0, 1])\r\n fig.tight_layout()\r\n fig.canvas.flush_events()\r\n print(i)\r\n time.sleep(0.01)\r\n if i == 25:\r\n fig.set_size_inches(3, 3)\r\n plt.ioff()\r\n plt.show()\r\n\r\nif __name__ == '__main__':\r\n test_subplot_crash_with_matplotlib222()\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\nWhile adding 25th subplot it crashes. You can crash it earlier if you manually resize the window to make it smaller.\r\n```\r\nTraceback (most recent call last):\r\n File \"tests/test_crash_matplotlib222.py\", line 28, in \u003cmodule\u003e\r\n test_subplot_crash_with_matplotlib222()\r\n File \"tests/test_crash_matplotlib222.py\", line 18, in test_subplot_crash_with_matplotlib222\r\n ax = fig.add_subplot(10, 10, i+1)\r\n File \"/home/marian/.local/lib/python3.5/site-packages/matplotlib/figure.py\", line 1239, in add_subplot\r\n a = subplot_class_factory(projection_class)(self, *args, **kwargs)\r\n File \"/home/marian/.local/lib/python3.5/site-packages/matplotlib/axes/_subplots.py\", line 77, in __init__\r\n self._axes_class.__init__(self, fig, self.figbox, **kwargs)\r\n File \"/home/marian/.local/lib/python3.5/site-packages/matplotlib/axes/_base.py\", line 488, in __init__\r\n raise ValueError('Width and height specified must be non-negative')\r\nValueError: Width and height specified must be non-negative\r\n\r\n```\r\n\r\n**Expected outcome**\r\nInteractive matplotlib window with dynamically added 100 plots. While plots are being added window should be resizable. After 25'th plot it will make itself smaller in an effort to reproduce the bug. In Matplotlib version 2.0.2 it works without crashing.\r\n\r\n**Matplotlib version**\r\n\u003c!--Please specify your platform and versions of the relevant libraries you are using:--\u003e\r\n * Operating system: Kubuntu 16.04 64 bit, Linux 4.13.0-38-generic #43~16.04.1-Ubuntu SMP Wed Mar 14 17:48:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux\r\n * Matplotlib version: 2.2.2\r\n * Matplotlib backend (`print(matplotlib.get_backend())`): TkAgg\r\n * Python version: 3.5.2\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:\r\n`pip3 install --user matplotlib==2.2.2`\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/mdovgialo","@type":"Person","name":"mdovgialo"},"datePublished":"2018-04-25T11:32:03.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/11123/matplotlib/issues/11123"}
| 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:08f2b0f6-eaf2-4fa5-2a86-9ef7c4a22532 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D20C:28F8C1:6B346D:9CB831:6A55F5B8 |
| html-safe-nonce | bf36c4f88730c806b651329459f7cd7428b2d679bd2e969e0771bf1c5190b132 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMjBDOjI4RjhDMTo2QjM0NkQ6OUNCODMxOjZBNTVGNUI4IiwidmlzaXRvcl9pZCI6Ijg1MTM2ODcwMTAwNDA3MzkyNTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 6ea42c9c11cd4adfce9db997e4a85e8be31bf11dff3299c0e2e5c7faf27aee73 |
| hovercard-subject-tag | issue:317588305 |
| 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/11123/issue_layout |
| twitter:image | https://opengraph.githubassets.com/264081f27d8008467add876f5f3954fca01faeb17417520f18ea771cb26f0653/matplotlib/matplotlib/issues/11123 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/264081f27d8008467add876f5f3954fca01faeb17417520f18ea771cb26f0653/matplotlib/matplotlib/issues/11123 |
| og:image:alt | Bug report Bug summary Adding subplots repeatedly to a figure in interactive mode can sometimes crash Matplotlib version 2.2.2, in version 2.0.2 everything works. Sometimes it does not crash, but w... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mdovgialo |
| 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