obspy.core.util.misc.MatplotlibBackend

class MatplotlibBackend(backend, sloppy=True, close=False)[source]

Bases: builtins.object

A helper class for switching the matplotlib backend.

Can be used as a context manager to temporarily switch the backend or by using the switch_backend() staticmethod.

The context manager has no effect when setting backend=None.

Parameters:
  • backend (str) Name of matplotlib backend to switch to.
  • sloppy (bool) If True, uses matplotlib.pyplot.switch_backend() and no warning will be shown if the backend was not switched successfully. If False, additionally tries to use matplotlib.use() first and also shows a warning if the backend was not switched successfully.
  • close (bool) Whether to close all matplotlib figures when exiting the context manager.

Attributes

__dict__
__doc__ str(object=’‘) -> str
__module__ str(object=’‘) -> str
__weakref__ list of weak references to the object (if defined)

Public Methods

switch_backend Switch matplotlib backend.

Special Methods

__dir__ default dir() implementation
__enter__
__exit__
__format__ default object formatter
__init__
__new__ Create and return a new object.
__reduce__ helper for pickle
__reduce_ex__ helper for pickle
__sizeof__ size of object in memory, in bytes
__subclasshook__ Abstract classes can override this to customize issubclass().