@@ -17,11 +17,11 @@ def current_backend_module():
1717 return _backend_mod
1818
1919
20- def switch_backend (newbackend = None ):
20+ def select_gui_toolkit (newbackend = None ):
2121 """
22- Close all open figures and set the Matplotlib backend .
22+ Select the GUI toolkit to use .
2323
24- The argument is case-insensitive. Switching to an interactive backend is
24+ The argument is case-insensitive. Switching between GUI toolkits is
2525 possible only if no event loop for another interactive backend has started.
2626 Switching to and from non-interactive backends is always possible.
2727
@@ -34,14 +34,13 @@ def switch_backend(newbackend=None):
3434 -------
3535 _Backend
3636 The backend selected.
37+
3738 """
3839 global _backend_mod
3940
4041 # work-around the sentinel resolution in Matplotlib 😱
4142 if newbackend is None :
4243 newbackend = dict .__getitem__ (rcParams , "backend" )
43- # make sure the init is pulled up so we can assign to it later
44- import matplotlib .backends
4544
4645 if newbackend is rcsetup ._auto_backend_sentinel :
4746 current_framework = cbook ._get_running_interactive_framework ()
@@ -67,14 +66,14 @@ def switch_backend(newbackend=None):
6766 # are of worse quality.
6867 for candidate in candidates :
6968 try :
70- return switch_backend (candidate )
69+ return select_gui_toolkit (candidate )
7170 except ImportError :
7271 continue
7372
7473 else :
7574 # Switching to Agg should always succeed; if it doesn't, let the
7675 # exception propagate out.
77- return switch_backend ("agg" )
76+ return select_gui_toolkit ("agg" )
7877
7978 if isinstance (newbackend , str ):
8079 # Backends are implemented as modules, but "inherit" default method
0 commit comments