@@ -1338,6 +1338,7 @@ def rc_file_defaults():
1338
1338
"""
1339
1339
rcParams .update (rcParamsOrig )
1340
1340
1341
+
1341
1342
_use_error_msg = """
1342
1343
This call to matplotlib.use() has no effect because the backend has already
1343
1344
been chosen; matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
@@ -1408,6 +1409,12 @@ def use(arg, warn=True, force=False):
1408
1409
reload (sys .modules ['matplotlib.backends' ])
1409
1410
1410
1411
1412
+ try :
1413
+ use (os .environ ['MPLBACKEND' ])
1414
+ except KeyError :
1415
+ pass
1416
+
1417
+
1411
1418
def get_backend ():
1412
1419
"""Return the name of the current backend."""
1413
1420
return rcParams ['backend' ]
@@ -1435,33 +1442,6 @@ def tk_window_focus():
1435
1442
return False
1436
1443
return rcParams ['tk.window_focus' ]
1437
1444
1438
- # Now allow command line to override
1439
-
1440
- # Allow command line access to the backend with -d (MATLAB compatible
1441
- # flag)
1442
-
1443
- for s in sys .argv [1 :]:
1444
- # cast to str because we are using unicode_literals,
1445
- # and argv is always str
1446
- if s .startswith (str ('-d' )) and len (s ) > 2 : # look for a -d flag
1447
- try :
1448
- use (s [2 :])
1449
- warnings .warn ("Using the -d command line argument to select a "
1450
- "matplotlib backend is deprecated. Please use the "
1451
- "MPLBACKEND environment variable instead." ,
1452
- mplDeprecation )
1453
- break
1454
- except (KeyError , ValueError ):
1455
- pass
1456
- # we don't want to assume all -d flags are backends, e.g., -debug
1457
- else :
1458
- # no backend selected from the command line, so we check the environment
1459
- # variable MPLBACKEND
1460
- try :
1461
- use (os .environ ['MPLBACKEND' ])
1462
- except KeyError :
1463
- pass
1464
-
1465
1445
1466
1446
# Jupyter extension paths
1467
1447
def _jupyter_nbextension_paths ():
0 commit comments