The sherpa.plot module
A visualization interface to Sherpa.
Classes provide access to common plotting tasks, which is done by the
plotting backend defined in the options.plot_pkg
setting of the
Sherpa configuration file. Note that plot objects can be created and
used even when only the sherpa.plot.backends.BasicBackend
is
available, it is just that no graphical display will be created.
Which backend is used?
When this module is first imported, Sherpa tries to import the
backends installed with Sherpa in the order listed in the
options.plot_pkg
setting from the sherpa.rc
startup file.
The first module that imports successfully is set as the active
backend. The following command prints the name of the backend:
>>> from sherpa import plot
>>> print(plot.backend.name)
pylab
Change the backend
After the initial import, the backend can be changed by loading one of the plotting backends shipped with sherpa (or any other module that provides the same interface):
>>> from sherpa.plot.pylab_backend import PylabBackend
>>> plot.backend = PylabBackend()
Creating a plot
A plot backend can act as a context manager to apply a specific backend to just one plot without globally changing the backend for the rest of the session:
>>> from sherpa.plot.pylab_backend import PylabBackend
>>> with PylabBackend():
... # Now call the plot/overplot or contour/overcontour methods
... obj.plot()
This handles setting up the backend, handles any error handling, and then ends the session.
Classes
|
Base class for line plots |
|
Base class for contour plots |
|
Base class for point plots |
|
Base class for image plots |
Base class for histogram plots |
|
Base class for histogram-style plots with a prepare method. |
|
Create 1D histogram plots of data values. |
|
Display a model as a histogram. |
|
Display a source model as a histogram. |
|
|
Display the probability density of an array. |
|
Display the cumulative distribution of an array. |
Derived class for creating 1D likelihood ratio distribution plots |
|
|
Create multiple plots. |
|
Multiple plots that share a common axis |
Combine multiple line-style plots. |
|
|
Create 1D plots of data values. |
Derived class for creating 1D PSF kernel data plots |
|
Create contours of 2D data. |
|
Derived class for creating 2D PSF Kernel contours |
|
Create 1D plots of model values. |
|
Component model plots. |
|
Component model plots for histogram data. |
|
Create 1D plots of unconvolved model values. |
|
Component source plots. |
|
Component source plots for histogram data. |
|
|
Derived class for creating 1D PSF kernel data plots |
Derived class for creating 2D model contours |
|
Derived class for creating 2D PSF contours |
|
Derived class for creating 2D model contours |
|
|
Combine data and model plots for 1D data. |
Derived class for creating 2D combination data and model contours |
|
Residuals of model + data. |
|
Create plots of the delta-chi value per point. |
|
Create plots of the chi-square value per point. |
|
Create plots of the ratio of data to model per point. |
|
Create plots of the residuals (data - model) per point. |
|
Residuals of model + data for histogram data. |
|
Create plots of the delta-chi value per point. |
|
Create plot of the ChiSq residuals per point. |
|
Create plots of the ratio value per point. |
|
Create plots of the residual value per point. |
|
Residuals of model + data for contour data. |
|
Derived class for creating 2D residual contours (data-model) |
|
Derived class for creating 2D ratio contours (data divided by model) |
|
The base class for 1D confidence plots. |
|
The base class for 2D confidence contours. |
|
The Interval-Projection method. |
|
The Interval-Projection method. |
|
The Region-Projection method. |
|
The Region-Projection method. |
|
|
Set the Sherpa plotting backend as a context, e.g. for a single plot. |
Functions
|
Set the Sherpa plotting backend. |