72
72
_log = logging .getLogger (__name__ )
73
73
74
74
75
- ## Backend detection ##
76
-
77
-
78
- # FIXME: Deprecate.
79
- def _backend_selection ():
80
- """
81
- If rcParams['backend_fallback'] is true, we will check (at backend
82
- load-time) to see if the current backend is compatible with the current
83
- running event loop, and if not switches to a compatible one.
84
- """
85
- if rcParams ["backend_fallback" ]:
86
- if (dict .__getitem__ (rcParams , "backend" ) in _interactive_bk
87
- and _get_running_interactive_framework ()):
88
- dict .__setitem__ (
89
- rcParams , "backend" , rcsetup ._auto_backend_sentinel )
90
-
91
-
92
- _backend_selection ()
93
-
94
-
95
75
## Global ##
96
76
97
77
@@ -2348,16 +2328,23 @@ def _autogen_docstring(base):
2348
2328
return lambda func : addendum (docstring .copy_dedent (base )(func ))
2349
2329
2350
2330
2351
- # just to be safe. Interactive mode can be turned on without
2331
+ # If rcParams['backend_fallback'] is true, and an interactive backend is
2332
+ # requested, ignore rcParams['backend'] and force selection of a backend that
2333
+ # is compatible with the current running interactive framework.
2334
+ if (rcParams ["backend_fallback" ]
2335
+ and dict .__getitem__ (rcParams , "backend" ) in _interactive_bk
2336
+ and _get_running_interactive_framework ()):
2337
+ dict .__setitem__ (rcParams , "backend" , rcsetup ._auto_backend_sentinel )
2338
+ # Set up the backend.
2339
+ switch_backend (rcParams ["backend" ])
2340
+
2341
+ # Just to be safe. Interactive mode can be turned on without
2352
2342
# calling `plt.ion()` so register it again here.
2353
2343
# This is safe because multiple calls to `install_repl_displayhook`
2354
2344
# are no-ops and the registered function respect `mpl.is_interactive()`
2355
2345
# to determine if they should trigger a draw.
2356
2346
install_repl_displayhook ()
2357
2347
2358
- # Set up the backend.
2359
- switch_backend (rcParams ["backend" ])
2360
-
2361
2348
2362
2349
################# REMAINING CONTENT GENERATED BY boilerplate.py ##############
2363
2350
0 commit comments