plot

sherpa.astro.ui.plot(*args)

Create one or more plot types.

The plot function creates one or more plots, depending on the arguments it is sent: a plot type, followed by an optional data set identifier, and this can be repeated. If no data set identifier is given for a plot type, the default identifier - as returned by get_default_id - is used.

Raises:sherpa.utils.err.ArgumentErr – The data set does not support the requested plot type.

See also

get_default_id()
Return the default data set identifier.
sherpa.astro.ui.set_analysis()
Set the units used when fitting and displaying spectral data.
set_xlinear()
New plots will display a linear X axis.
set_xlog()
New plots will display a logarithmically-scaled X axis.
set_ylinear()
New plots will display a linear Y axis.
set_ylog()
New plots will display a logarithmically-scaled Y axis.

Notes

The supported plot types depend on the data set type, and include the following list. There are also individual functions, with plot_ prepended to the plot type, such as plot_data (the bkg variants use a prefix of plot_bkg_). There are also several multiple-plot commands (e.g. plot_fit_resid).

arf
The ARF for the data set (only for DataPHA data sets).
bkg
The background.
bkgchisqr
The chi-squared statistic calculated for each bin when fitting the background.
bkgdelchi
The residuals for each bin, calculated as (data-model) divided by the error, for the background.
bkgfit
The data (as points) and the convolved model (as a line), for the background data set.
bkgmodel
The convolved background model.
bkgratio
The residuals for each bin, calculated as data/model, for the background data set.
bkgresid
The residuals for each bin, calculated as (data-model), for the background data set.
bkgsource
The un-convolved background model.
chisqr
The chi-squared statistic calculated for each bin.
data
The data (which may be background subtracted).
delchi
The residuals for each bin, calculated as (data-model) divided by the error.
fit
The data (as points) and the convolved model (as a line).
kernel
The PSF kernel associated with the data set.
model
The convolved model.
psf
The unfiltered PSF kernel associated with the data set.
ratio
The residuals for each bin, calculated as data/model.
resid
The residuals for each bin, calculated as (data-model).
source
The un-convolved model.

The plots can be specialized for a particular data type, such as the set_analysis command controlling the units used for PHA data sets.

See the documentation for the individual routines for information on how to configure the plots.

The plot capabilities depend on what plotting backend, if any, is installed. If there is none available, a warning message will be displayed when sherpa.ui or sherpa.astro.ui is imported, and the plot set of commands will not create any plots. The choice of back end is made by changing the options.plot_pkg setting in the Sherpa configuration file.

Examples

Plot the data for the default data set. This is the same as plot_data.

>>> plot("data")

Plot the data for data set 2.

>>> plot("data", 2)

Plot the data and ARF for the default data set, in two seaparate plots.

>>> plot("data", "arf")

Plot the fit (data and model) for data sets 1 and 2, in two separate plots.

>>> plot("fit", 1, "fit", 2)

Plot the fit (data and model) for data sets “fit” and “jet”, in two separate plots.

>>> plot("fit", "nucleus", "fit", "jet")