File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed
Filter options
Expand file tree Collapse file tree 1 file changed +11
-9
lines changed
Original file line number Diff line number Diff line change @@ -999,9 +999,18 @@ def use(arg, warn=True, force=False):
999
999
:func:`matplotlib.get_backend`.
1000
1000
1001
1001
"""
1002
+ # Lets determine the proper backend name first
1003
+ if arg .startswith ('module://' ):
1004
+ name = arg
1005
+ else :
1006
+ # Lowercase only non-module backend names (modules are case-sensitive)
1007
+ arg = arg .lower ()
1008
+ name = validate_backend (arg )
1009
+
1002
1010
# Check if we've already set up a backend
1003
1011
if 'matplotlib.backends' in sys .modules :
1004
- if warn :
1012
+ # Warn only if called with a different name
1013
+ if (rcParams ['backend' ] != name ) and warn :
1005
1014
warnings .warn (_use_error_msg )
1006
1015
1007
1016
# Unless we've been told to force it, just return
@@ -1011,14 +1020,7 @@ def use(arg, warn=True, force=False):
1011
1020
else :
1012
1021
need_reload = False
1013
1022
1014
- # Set-up the proper backend name
1015
- if arg .startswith ('module://' ):
1016
- name = arg
1017
- else :
1018
- # Lowercase only non-module backend names (modules are case-sensitive)
1019
- arg = arg .lower ()
1020
- name = validate_backend (arg )
1021
-
1023
+ # Store the backend name
1022
1024
rcParams ['backend' ] = name
1023
1025
1024
1026
# If needed we reload here because a lot of setup code is triggered on
You can’t perform that action at this time.
0 commit comments