obspy.core.util.misc.MatplotlibBackend

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

Bases: 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.

Public Methods

switch_backend

Switch matplotlib backend.

Special Methods

MatplotlibBackend.__delattr__(name, /)

Implement delattr(self, name).

MatplotlibBackend.__dir__()

Default dir() implementation.

MatplotlibBackend.__enter__()[source]
MatplotlibBackend.__eq__(value, /)

Return self==value.

MatplotlibBackend.__exit__(exc_type, exc_val, exc_tb)[source]
MatplotlibBackend.__format__(format_spec, /)

Default object formatter.

MatplotlibBackend.__ge__(value, /)

Return self>=value.

MatplotlibBackend.__getattribute__(name, /)

Return getattr(self, name).

MatplotlibBackend.__gt__(value, /)

Return self>value.

MatplotlibBackend.__hash__()

Return hash(self).

MatplotlibBackend.__init__(backend, sloppy=True, close=False)[source]
MatplotlibBackend.__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

MatplotlibBackend.__le__(value, /)

Return self<=value.

MatplotlibBackend.__lt__(value, /)

Return self<value.

MatplotlibBackend.__ne__(value, /)

Return self!=value.

MatplotlibBackend.__new__(**kwargs)
MatplotlibBackend.__reduce__()

Helper for pickle.

MatplotlibBackend.__reduce_ex__(protocol, /)

Helper for pickle.

MatplotlibBackend.__repr__()

Return repr(self).

MatplotlibBackend.__setattr__(name, value, /)

Implement setattr(self, name, value).

MatplotlibBackend.__sizeof__()

Size of object in memory, in bytes.

MatplotlibBackend.__str__()

Return str(self).

MatplotlibBackend.__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).