Title: Safely import pyplot if a GUI framework is already running. by anntzer · Pull Request #18316 · matplotlib/matplotlib · GitHub
Open Graph Title: Safely import pyplot if a GUI framework is already running. by anntzer · Pull Request #18316 · matplotlib/matplotlib
X Title: Safely import pyplot if a GUI framework is already running. by anntzer · Pull Request #18316 · matplotlib/matplotlib
Description: configure_subplots now needs to import pyplot (because that's how we can spin up a new figure as needed), but when relying on embedding we could well reach that point with an already running interactive framework, pyplot never imported, and an incompatible rcParams["backend"] (which had not been read yet). For example, run examples/user_interfaces/embedding_in_tk_sgskip.py with a non-tk backend set in your matplotlibrc: clicking on the the configure_subplots button triggers a "cannot load backend 'foo' which requires the 'foo' interactive framework, as 'bar' is currently running". Instead, use a helper to safely import pyplot when another interactive framework may already be running. The list of frameworks that _get_running_interactive_framework returns is fixed, so we can just hardcode the mapping. (We are going to ignore the user-set rcParams["backend"] anyways.) followup to #16818, especially #16818 (review) (which this does not fix, it's just the easy first step). PR Summary PR Checklist Has Pytest style unit tests Code is Flake 8 compliant New features are documented, with examples if plot related Documentation is sphinx and numpydoc compliant Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there) Documented in doc/api/next_api_changes/* if API changed in a backward-incompatible way
Open Graph Description: configure_subplots now needs to import pyplot (because that's how we can spin up a new figure as needed), but when relying on embedding we could well reach that point with an already running in...
X Description: configure_subplots now needs to import pyplot (because that's how we can spin up a new figure as needed), but when relying on embedding we could well reach that point with an already runnin...
Opengraph URL: https://github.com/matplotlib/matplotlib/pull/18316
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:f4625131-23d3-3533-491e-d2107d716fa3 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | D5AA:3161F8:2BA987E:3B57338:6A549244 |
| html-safe-nonce | 7d146541d04aedb55e2ea3b8a6639e4adf413707b57b467b18c09ec3dd8c72dc |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENUFBOjMxNjFGODoyQkE5ODdFOjNCNTczMzg6NkE1NDkyNDQiLCJ2aXNpdG9yX2lkIjoiNzk5NjA3MjU1ODE0MjQ2MDQ4NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7e17a4a9b100064e189feeb3d591589df64a1e9782421d3345d8d220b8f26c92 |
| hovercard-subject-tag | pull_request:471766038 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/matplotlib/matplotlib/pull/18316/files |
| twitter:image | https://avatars.githubusercontent.com/u/1322974?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/1322974?s=400&v=4 |
| og:image:alt | configure_subplots now needs to import pyplot (because that's how we can spin up a new figure as needed), but when relying on embedding we could well reach that point with an already running in... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f8cfff6384f62259baea531c7f58bc7040f8dd92 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width