Title: Figure cannot be closed if it has associated Agg canvas · Issue #18163 · matplotlib/matplotlib · GitHub
Open Graph Title: Figure cannot be closed if it has associated Agg canvas · Issue #18163 · matplotlib/matplotlib
X Title: Figure cannot be closed if it has associated Agg canvas · Issue #18163 · matplotlib/matplotlib
Description: Bug report ** plt.fignum_exists() returns True after figure is closed** Code snippet below closes figure after creating FigureCanvasAgg, and it works with matplotlib-3.2.1 but fails with matplotlib-3.3.0 Code for reproduction import matp...
Open Graph Description: Bug report ** plt.fignum_exists() returns True after figure is closed** Code snippet below closes figure after creating FigureCanvasAgg, and it works with matplotlib-3.2.1 but fails with matplotlib...
X Description: Bug report ** plt.fignum_exists() returns True after figure is closed** Code snippet below closes figure after creating FigureCanvasAgg, and it works with matplotlib-3.2.1 but fails with matplotlib...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/18163
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Figure cannot be closed if it has associated Agg canvas","articleBody":"### Bug report\r\n\r\n** plt.fignum_exists() returns True after figure is closed**\r\n\r\nCode snippet below closes figure after creating `FigureCanvasAgg`, and it works with matplotlib-3.2.1 but fails with matplotlib-3.3.0\r\n\r\n**Code for reproduction**\r\n\r\n```python\r\nimport matplotlib\r\nmatplotlib.use('Agg')\r\nimport matplotlib.pyplot as plt\r\n\r\nfigure = plt.figure()\r\nplt.axis('scaled')\r\nplt.tight_layout()\r\nmatplotlib.backends.backend_agg.FigureCanvasAgg(figure)\r\nplt.close(figure)\r\nprint(\"Matplotlib version:\", matplotlib.__version__)\r\nassert plt.fignum_exists(figure.number) == False\r\n```\r\n\r\n**Actual outcome**\r\n\r\n```\r\nMatplotlib version: 3.3.0\r\nTraceback (most recent call last):\r\n File \"figure_exists.py\", line 11, in \u003cmodule\u003e\r\n assert plt.fignum_exists(figure.number) == False\r\nAssertionError\r\n\r\n```\r\n\r\n**Expected outcome**\r\nNo assertion, which is easy to reproduce if one to downgrade to matplotlib-3.2.1:\r\n```\r\n pip3 install matplotlib==3.2.1 --user; python figure_exists.py \r\nCollecting matplotlib==3.2.1\r\n Using cached https://files.pythonhosted.org/packages/b2/c2/71fcf957710f3ba1f09088b35776a799ba7dd95f7c2b195ec800933b276b/matplotlib-3.2.1-cp37-cp37m-manylinux1_x86_64.whl\r\nRequirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,\u003e=2.0.1 in /usr/lib/python3.7/site-packages (from matplotlib==3.2.1) (2.4.0)\r\nRequirement already satisfied: numpy\u003e=1.11 in /usr/local/lib64/python3.7/site-packages (from matplotlib==3.2.1) (1.18.4)\r\nRequirement already satisfied: python-dateutil\u003e=2.1 in /usr/lib/python3.7/site-packages (from matplotlib==3.2.1) (2.8.0)\r\nRequirement already satisfied: cycler\u003e=0.10 in /usr/lib/python3.7/site-packages (from matplotlib==3.2.1) (0.10.0)\r\nRequirement already satisfied: kiwisolver\u003e=1.0.1 in /usr/lib64/python3.7/site-packages (from matplotlib==3.2.1) (1.1.0)\r\nRequirement already satisfied: six\u003e=1.5 in /usr/lib/python3.7/site-packages (from python-dateutil\u003e=2.1-\u003ematplotlib==3.2.1) (1.12.0)\r\nRequirement already satisfied: setuptools in /usr/lib/python3.7/site-packages (from kiwisolver\u003e=1.0.1-\u003ematplotlib==3.2.1) (40.8.0)\r\nInstalling collected packages: matplotlib\r\n Found existing installation: matplotlib 3.3.0\r\n Uninstalling matplotlib-3.3.0:\r\n Successfully uninstalled matplotlib-3.3.0\r\nSuccessfully installed matplotlib-3.2.1\r\nMatplotlib version: 3.2.1\r\n```\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: Fedora Core 30\r\n * Matplotlib version: 3.3.0 (installed via pip as `pip3 install matplotlib==3.3.0 --user` )\r\n * Matplotlib backend (`print(matplotlib.get_backend())`):\r\n * Python version: 3.7.0\r\n * Jupyter version (if applicable):\r\n * Other libraries: \r\n\r\n\u003c!--Please tell us how you installed matplotlib and python e.g., from source, pip, conda--\u003e\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/malfet","@type":"Person","name":"malfet"},"datePublished":"2020-08-04T01:38:09.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/18163/matplotlib/issues/18163"}
| 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:b85261d4-8c65-170b-d6fa-0058ad4ab983 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D0EE:EAA14:1FE0DA:2A96F3:6A52C58A |
| html-safe-nonce | 81991d038f3e1900115bb2391dd8be77923b6b183ebc69215c87059063658384 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMEVFOkVBQTE0OjFGRTBEQToyQTk2RjM6NkE1MkM1OEEiLCJ2aXNpdG9yX2lkIjoiMjA1MTkwNTI4MTUyOTY2MDgxMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2f170913a4d23146e1d6d61294f4c84da8d8e2c9afc57c7b0b89863c86ee53a5 |
| hovercard-subject-tag | issue:672441391 |
| 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/18163/issue_layout |
| twitter:image | https://opengraph.githubassets.com/21a16029fa94100c8090ab60315e89bc1e56a01e7ecefb57bf7e11aa7d871690/matplotlib/matplotlib/issues/18163 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/21a16029fa94100c8090ab60315e89bc1e56a01e7ecefb57bf7e11aa7d871690/matplotlib/matplotlib/issues/18163 |
| og:image:alt | Bug report ** plt.fignum_exists() returns True after figure is closed** Code snippet below closes figure after creating FigureCanvasAgg, and it works with matplotlib-3.2.1 but fails with matplotlib... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | malfet |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| 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 | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width