class sherpa.plot.TemporaryPlottingBackend(new_backend: BaseBackend)[source] [edit on github]

Bases: AbstractContextManager

Set the Sherpa plotting backend as a context, e.g. for a single plot

This changes the logging level globally for all modules in sherpa.


new_backend (string, class, or instance) – Set a sherpa plotting backend. The backend can be passed in as an instance of a plotting backend class. For simplicity, the user can also pass in a string naming a loaded backend class or the class itself; calling this context manager will then create an instance.


>>> from sherpa.plot import TemporaryPlottingBackend, DataPlot
>>> from sherpa.data import Data1D
>>> with TemporaryPlottingBackend('pylab'):
...     x1 = [100, 200, 600, 1200]
...     y1 = [2000, 2100, 1400, 3050]
...     d1 = Data1D('oned', x1, y1)
...     plot1 = DataPlot()
...     plot1.prepare(d1)
...     plot1.plot()