Title: Existing FigureCanvasQT objects destroyed by call to plt.figure · Issue #14426 · matplotlib/matplotlib · GitHub
Open Graph Title: Existing FigureCanvasQT objects destroyed by call to plt.figure · Issue #14426 · matplotlib/matplotlib
X Title: Existing FigureCanvasQT objects destroyed by call to plt.figure · Issue #14426 · matplotlib/matplotlib
Description: Bug report Bug summary For a number of years, I have been maintaining an interactive application that embeds subclassed FigureCanvasQT objects within a PyQt application. Up until Matplotlib v3.0.3., it was possible to create standard Mat...
Open Graph Description: Bug report Bug summary For a number of years, I have been maintaining an interactive application that embeds subclassed FigureCanvasQT objects within a PyQt application. Up until Matplotlib v3.0.3....
X Description: Bug report Bug summary For a number of years, I have been maintaining an interactive application that embeds subclassed FigureCanvasQT objects within a PyQt application. Up until Matplotlib v3.0.3....
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/14426
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Existing FigureCanvasQT objects destroyed by call to plt.figure","articleBody":"### Bug report\r\n\r\n**Bug summary**\r\n\r\nFor a number of years, I have been maintaining an interactive application that embeds subclassed FigureCanvasQT objects within a PyQt application. Up until Matplotlib v3.0.3., it was possible to create standard Matplotlib PyQt figures, i.e., using `plt.figure` within an embedded IPython shell, that coexist with the subclassed canvas objects. Now in Matplotlib v3.1.0, a call to `plt.figure()` destroys all the other canvas objects. \r\n\r\nUnfortunately, I cannot debug this within Visual Studio since I am currently unable to install Matplotlib from the source. By going through the `new_figure_manager` code line by line, I can confirm that the windows are destroyed when calling `FigureCanvasQT.__init__(figure)`, but not when calling `FigureCanvasBase.__init__(figure)`, but I can't work out what triggers the destruction of the other windows. I presume the subclassed canvasses are not being registered somewhere, and `pyplot` assumes they are no longer active, but I am hoping someone will show me where to look. This may not be a Matplotlib bug, but it's certainly an unwelcome side effect in my application.\r\n\r\n**Code for reproduction**\r\nIf you have `nexpy` installed (`pip install nexpy`) and launch it, you can reproduce this from within the embedded IPython shell with the following, which creates a new subclassed window and then attempts to open a regular `pyplot` window.:\r\n\r\n```\r\nIn [1]: new_window=NXPlotView()\r\nIn [2]: plt.get_fignums()\r\nOut[2]: [1, 2]\r\nIn [3]: plt.figure()\r\n```\r\nThere are two figure numbers, because NeXpy automatically creates a window with a figure number of 1 when it is launched.\r\n\r\n**Actual outcome**\r\n\r\nA new window with an updated figure number is created but all other windows not created by `pyplot` are destroyed.\r\n\r\n```\r\nIn [4]: plt.get_fignums()\r\nOut[4]: [3]\r\n```\r\n\r\n**Expected outcome**\r\n\r\nIn Matplotlib v3.0.3, a new `pyplot` window is created by the PyQt5 backend without destroying anything else.\r\n\r\n```\r\nIn [4]: plt.get_fignums()\r\nOut[4]: [1, 2, 3]\r\n```\r\n\r\n**Matplotlib version**\r\n * Operating system: Mac OS v10.14.5\r\n * Matplotlib version: 3.1.0\r\n * Matplotlib backend: Qt5Agg\r\n * Python version: 3.7.2\r\n * Jupyter version (if applicable): 1.0.0\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","author":{"url":"https://github.com/rayosborn","@type":"Person","name":"rayosborn"},"datePublished":"2019-06-02T21:12:25.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":23},"url":"https://github.com/14426/matplotlib/issues/14426"}
| 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:0a5e02f3-981e-fb9a-3291-23d8af476958 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9BB0:16AB2B:EE803D:15CB079:6A5615C5 |
| html-safe-nonce | 61fecd9c83052a51d31039ab47cdcbdc5b9e6c5a9697ab379dea251d5454b500 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QkIwOjE2QUIyQjpFRTgwM0Q6MTVDQjA3OTo2QTU2MTVDNSIsInZpc2l0b3JfaWQiOiI4Mjc2NTQwOTAxODkzMjE1Njg1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 913cdd244f087e8f003853fd5f104a225a9094404f0ca002e7c367ee6c56e003 |
| hovercard-subject-tag | issue:451235504 |
| 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/14426/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e245a2a43e78c1c444785747abdb8e81690e92c49562a74acdf3a37bd33d6160/matplotlib/matplotlib/issues/14426 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e245a2a43e78c1c444785747abdb8e81690e92c49562a74acdf3a37bd33d6160/matplotlib/matplotlib/issues/14426 |
| og:image:alt | Bug report Bug summary For a number of years, I have been maintaining an interactive application that embeds subclassed FigureCanvasQT objects within a PyQt application. Up until Matplotlib v3.0.3.... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rayosborn |
| hostname | github.com |
| expected-hostname | github.com |
| None | f4368738fc918fecd9b3958f6b49218bbe60d4185f38e72e3954e11f1ad0213a |
| 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 | b76b9cc70d30da50674184c9c66c56423fd0b93c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width