Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
FIX: be more careful about not importing pyplot early#17764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Both fair points. |
In matplotlib.use we import pyplot to use `switch_backend`, howeverif the user calls `mpl.use(...)` before importing pyplot thenduring the initial import of pyplot, before we set the selectedbackend we try to set the backend set via rcParams.This change only imports pyplot if it is already imported, otherwiseit is safe to just set the rcParams and not go through the full`plt.switch_backend` path.closesmatplotlib#17763
The test failure was real, it turns out we were relying on the implicit in Hopefully the comments are clear? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
looks reasonable.
…764-on-v3.3.xBackport PR#17764 on branch v3.3.x (FIX: be more careful about not importing pyplot early)
PR Summary
In matplotlib.use we import pyplot to use
switch_backend
, howeverif the user calls
mpl.use(...)
before importing pyplot thenduring 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