8000 ENH: allow matplotlib.use after getbackend by jklymak · Pull Request #12608 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

ENH: allow matplotlib.use after getbackend #12608

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 29, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading< 8000 /span>
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1292,7 +1292,7 @@ def __exit__(self, exc_type, exc_value, exc_tb):
self.__fallback()


def use(arg, warn=True, force=False):
def use(arg, warn=False, force=True):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it's very remotely an API break in the sense that some previously invalid calls to use() would raise a warning and do nothing whereas they will now throw an exception, but I'm not sure if it's worth an API note :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API note added. As per below I wonder if we really want to stick closer to the original behaviour and trap the Error, warn, and not switch the backend.

"""
Set the matplotlib backend to one of the known backends.

Expand All @@ -1318,11 +1318,11 @@ def use(arg, warn=True, force=False):
If True, warn if this is called after pyplot has been imported
and a backend is set up.

defaults to True
defaults to False

force : bool, optional
If True, attempt to switch the backend. This defaults to
False.
True.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mention that this will raise ImportError on failure, which occurs if an incompatible event loop has already started.


See Also
--------
Expand Down
0