Title: In 3.0.0 backend cannot be set if 'get_backend()' is run first · Issue #12362 · matplotlib/matplotlib · GitHub
Open Graph Title: In 3.0.0 backend cannot be set if 'get_backend()' is run first · Issue #12362 · matplotlib/matplotlib
X Title: In 3.0.0 backend cannot be set if 'get_backend()' is run first · Issue #12362 · matplotlib/matplotlib
Description: Bug report Bug summary In my code, I need to check whether the matplotlib backend has already been set. If it has not been set, I need to then set it to 'WXAgg'. In matplotlib 2.*, I was able to do this, but in matplotlib 3.0.0 it fails....
Open Graph Description: Bug report Bug summary In my code, I need to check whether the matplotlib backend has already been set. If it has not been set, I need to then set it to 'WXAgg'. In matplotlib 2.*, I was able to do...
X Description: Bug report Bug summary In my code, I need to check whether the matplotlib backend has already been set. If it has not been set, I need to then set it to 'WXAgg'. In matplotlib 2.*, I was ab...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/12362
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"In 3.0.0 backend cannot be set if 'get_backend()' is run first","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\nIn my code, I need to check whether the matplotlib backend has already been set. If it has not been set, I need to then set it to 'WXAgg'. In matplotlib 2.*, I was able to do this, but in matplotlib 3.0.0 it fails.\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\r\nif not matplotlib.get_backend() == 'WXAgg':\r\n matplotlib.use('WXAgg')\r\nprint('backend:', matplotlib.get_backend())\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\nWith matplotlib 3.0.0:\r\n```\r\n/Users/nebula/Python/PmagPy/programs/test.py:7: UserWarning: matplotlib.pyplot as already been /Users/nebula/Python/PmagPy/programs/test.py:7: UserWarning: matplotlib.pyplot as already been imported, this call will have no effect.\r\n matplotlib.use('WXAgg')\r\nbackend: MacOSX\r\n```\r\n\r\n**Expected outcome**\r\n\r\nWith matplotlib 2.2.3:\r\n```\r\nbackend: WXAgg\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: OSX High Sierra 10.13.6\r\n * Matplotlib version: 3.0.0\r\n * Matplotlib backend (`print(matplotlib.get_backend())`):\r\n * Python version: 3.6.6 (Anaconda, default channel)\r\n * Jupyter version (if applicable):\r\n * Other libraries: \r\n\r\n\r\n\u003c!--Please tell us how you installed matplotlib and python e.g., from source, pip, conda--\u003e\r\n\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/moonshoes87","@type":"Person","name":"moonshoes87"},"datePublished":"2018-10-01T20:14:39.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":16},"url":"https://github.com/12362/matplotlib/issues/12362"}
| 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:b8ec2c38-751a-4e57-1e73-f7373de2069d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AE0A:1EB2:281574:35D7CE:6A56E61F |
| html-safe-nonce | 34608d41cfba69661302c30418caa3d86eb8c9ab9f139720f27c0f09df4016fb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRTBBOjFFQjI6MjgxNTc0OjM1RDdDRTo2QTU2RTYxRiIsInZpc2l0b3JfaWQiOiIxNDA2MzcxMjExNjA5ODI2ODQ3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 070297baf40dff253b2b42ae51d575e4f4bd53a2f6c951dba8ebc3e07016da7f |
| hovercard-subject-tag | issue:365624496 |
| 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/12362/issue_layout |
| twitter:image | https://opengraph.githubassets.com/08c3946db6ff7cbf18a85a705969105b1e1bf854166ca6bce228a9001a59cdf5/matplotlib/matplotlib/issues/12362 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/08c3946db6ff7cbf18a85a705969105b1e1bf854166ca6bce228a9001a59cdf5/matplotlib/matplotlib/issues/12362 |
| og:image:alt | Bug report Bug summary In my code, I need to check whether the matplotlib backend has already been set. If it has not been set, I need to then set it to 'WXAgg'. In matplotlib 2.*, I was able to do... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | moonshoes87 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5220a278731283038daf0ed00b41f06ef7ff9539020ecc806c5c5a0fb6bda25a |
| 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 | 8684ae1a81cd3e4ef219b241179982bbda1a5b1f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width