set_backend

sherpa.plot.set_backend(new_backend: str | BaseBackend | type[BaseBackend]) None[source] [edit on github]

Set the Sherpa plotting backend.

Plotting backends are registered in Sherpa with a string name. See the examples below for how to get a list of available backends.

Parameters:

new_backend (string, class, or instance) – Set a sherpa plotting backend. The backend can be passed in as an object, or as a convenience, as a simple string

Example

Set the backend to use Pylab from matplotlib for plotting. This is probably what most users need:

>>> from sherpa.plot import set_backend
>>> set_backend('pylab')

Get a list of registered backends:

>>> from sherpa.plot import PLOT_BACKENDS
>>> PLOT_BACKENDS
{'BaseBackend': <class 'sherpa.plot.backends.BaseBackend'>, ...}

This list shows the names and the class for each backend. Details for each backend can be found in the Sherpa documentation or by inspecting the backend classes using normal Python functionality:

>>> from sherpa.plot.backends import BasicBackend
>>> help(BasicBackend)
Help on class BasicBackend in module sherpa.plot.backends:

class BasicBackend(BaseBackend)
|  A dummy backend for plotting.
...