plot_bkg
- sherpa.astro.ui.plot_bkg(id=None, bkg_id=None, replot=False, overplot=False, clearwindow=True, **kwargs)
Plot the background values for a PHA data set.
- Parameters
id (int or str, optional) – The data set that provides the data. If not given then the default identifier is used, as returned by
get_default_id
.bkg_id (int or str, optional) – Identify the background component to use, if there are multiple ones associated with the data set.
replot (bool, optional) – Set to
True
to use the values calculated by the last call toplot_bkg
. The default isFalse
.overplot (bool, optional) – If
True
then add the data to an existing plot, otherwise create a new plot. The default isFalse
.clearwindow (bool, optional) – Should the existing plot area be cleared before creating this new plot (e.g. for multi-panel plots)?
- Raises
sherpa.utils.err.ArgumentErr – If the data set does not contain PHA data.
sherpa.utils.err.IdentifierErr – If the
bkg_id
parameter is invalid.
See also
get_bkg_plot
Return the data used by plot_bkg.
get_default_id
Return the default data set identifier.
plot
Create one or more plot types.
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.
Examples
Plot the background from the default data set:
>>> plot_bkg()
Overplot the background from the ‘jet’ data set on the data. There is no scaling for differences in aperture or exposure time:
>>> plot_data('jet') >>> plot_bkg('jet', overplot=True)
Compare the first two background components of data set 1:
>>> plot_bkg(1, 1) >>> plot_bkg(1, 2, overplot=True)