MCPcopy Create free account
hub / github.com/ColdGrub1384/Pyto / use

Function use

site-packages/matplotlib/__init__.py:1346–1413  ·  view source on GitHub ↗

Set the matplotlib backend to one of the known backends. Parameters ---------- arg : str The backend to switch to. This can either be one of the 'standard' backend names: - interactive backends: GTK3Agg, GTK3Cairo, MacOSX, nbAgg, Qt4Agg

(arg, warn=False, force=True)

Source from the content-addressed store, hash-verified

1344
1345
1346def use(arg, warn=False, force=True):
1347 """
1348 Set the matplotlib backend to one of the known backends.
1349
1350 Parameters
1351 ----------
1352 arg : str
1353 The backend to switch to. This can either be one of the
1354 'standard' backend names:
1355
1356 - interactive backends:
1357 GTK3Agg, GTK3Cairo, MacOSX, nbAgg,
1358 Qt4Agg, Qt4Cairo, Qt5Agg, Qt5Cairo,
1359 TkAgg, TkCairo, WebAgg, WX, WXAgg, WXCairo
1360
1361 - non-interactive backends:
1362 agg, cairo, pdf, pgf, ps, svg, template
1363
1364 or a string of the form: ``module://my.module.name``.
1365
1366 Note: Standard backend names are case-insensitive here.
1367
1368 warn : bool, optional
1369 If True, warn if this is called after pyplot has been imported
1370 and a backend is set up.
1371
1372 defaults to False.
1373
1374 force : bool, optional
1375 If True, attempt to switch the backend. An ImportError is raised if
1376 an interactive backend is selected, but another interactive
1377 backend has already started. This defaults to True.
1378
1379 See Also
1380 --------
1381 :ref:`backends`
1382 matplotlib.get_backend
1383 """
1384 name = validate_backend(arg)
1385
1386 # if setting back to the same thing, do nothing
1387 if (dict.__getitem__(rcParams, 'backend') == name):
1388 pass
1389
1390 # Check if we have already imported pyplot and triggered
1391 # backend selection, do a bit more work
1392 elif 'matplotlib.pyplot' in sys.modules:
1393 # If we are here then the requested is different than the current.
1394 # If we are going to force the switch, never warn, else, if warn
1395 # is True, then direct users to `plt.switch_backend`
1396 if (not force) and warn:
1397 warnings.warn(
1398 ("matplotlib.pyplot as already been imported, "
1399 "this call will have no effect."),
1400 stacklevel=2)
1401
1402 # if we are going to force switching the backend, pull in
1403 # `switch_backend` from pyplot. This will only happen if

Callers 1

testFunction · 0.70

Calls 4

validate_backendFunction · 0.90
switch_backendFunction · 0.90
__getitem__Method · 0.45
warnMethod · 0.45

Tested by

no test coverage detected