| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Both fair points. |
Sorry, something went wrong.
In matplotlib.use we import pyplot to use `switch_backend`, however if the user calls `mpl.use(...)` before importing pyplot then during the initial import of pyplot, before we set the selected backend we try to set the backend set via rcParams. This change only imports pyplot if it is already imported, otherwise it is safe to just set the rcParams and not go through the full `plt.switch_backend` path. closes matplotlib#17763
|
The test failure was real, it turns out we were relying on the implicit in use to explode when the user asked for an unusable backend. I solved this by a) changing the backend_fallback rcparam in use (which I think we talked about before, but at least I was not sure about. Coming back to this again with a bit of time it seems clear that this is the correct behavior) b) add a pyplot import in the test to get the exception. Hopefully the comments are clear? |
Sorry, something went wrong.
There was a problem hiding this comment.
looks reasonable.
Sorry, something went wrong.
…764-on-v3.3.x Backport PR #17764 on branch v3.3.x (FIX: be more careful about not importing pyplot early)
| Back | FazBrowse Home | New Git URL |
PR Summary
In matplotlib.use we import pyplot to use switch_backend, however
if the user calls mpl.use(...) before importing pyplot then
during the initial import of pyplot, before we set the selected
backend we try to set the backend set via rcParams.
This change only imports pyplot if it is already imported, otherwise
it is safe to just set the rcParams and not go through the full
plt.switch_backend path.
closes #17763
This seems difficult to test given that it is dependent on import order.
PR Checklist