Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Backport PR #12022 on branch v3.0.x (Remove intent to deprecate rcParams["backend_fallback"].) #12029

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
Changes from all commits
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
Diff view
Diff view
35 changes: 11 additions & 24 deletions lib/matplotlib/pyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,26 +72,6 @@
_log = logging.getLogger(__name__)


## Backend detection ##


# FIXME: Deprecate.
def _backend_selection():
"""
If rcParams['backend_fallback'] is true, we will check (at backend
load-time) to see if the current backend is compatible with the current
running event loop, and if not switches to a compatible one.
"""
if rcParams["backend_fallback"]:
if (dict.__getitem__(rcParams, "backend") in _interactive_bk
and _get_running_interactive_framework()):
dict.__setitem__(
rcParams, "backend", rcsetup._auto_backend_sentinel)


_backend_selection()


## Global ##


Expand Down Expand Up @@ -2380,16 +2360,23 @@ def _autogen_docstring(base):
return lambda func: addendum(docstring.copy_dedent(base)(func))


# just to be safe. Interactive mode can be turned on without
# If rcParams['backend_fallback'] is true, and an interactive backend is
# requested, ignore rcParams['backend'] and force selection of a backend that
# is compatible with the current running interactive framework.
if (rcParams["backend_fallback"]
and dict.__getitem__(rcParams, "backend") in _interactive_bk
and _get_running_interactive_framework()):
dict.__setitem__(rcParams, "backend", rcsetup._auto_backend_sentinel)
# Set up the backend.
switch_backend(rcParams["backend"])

# Just to be safe. Interactive mode can be turned on without
# calling `plt.ion()` so register it again here.
# This is safe because multiple calls to `install_repl_displayhook`
# are no-ops and the registered function respect `mpl.is_interactive()`
# to determine if they should trigger a draw.
install_repl_displayhook()

# Set up the backend.
switch_backend(rcParams["backend"])


################# REMAINING CONTENT GENERATED BY boilerplate.py ##############

Expand Down