plot_bkg

sherpa.astro.ui.plot_bkg(id: IdType | IdTypes | None = None, bkg_id: IdType | None = None, replot: bool = False, overplot: bool = False, clearwindow: bool = True, **kwargs) → None

Plot the background values for a PHA data set.

Changed in version 4.18.0: Multiple data sets can be displayed by using a list of identifiers. Per-plot options can now be given by using a list of values.

Parameters:
idint, str, sequence of int or str, or None, optional

The data set that provides the data. If not given then the default identifier is used, as returned by get_default_id.

bkg_idint, str, or None, optional

Identify the background component to use, if there are multiple ones associated with the data set.

replotbool, optional

Set to True to use the values calculated by the last call to plot_bkg. The default is False.

overplotbool, optional

If True then add the data to an existing plot, otherwise create a new plot. The default is False.

clearwindowbool, 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)

Plot background components for datasets “flare” and “quiet”:

>>> plot_bkg(["flare", "quiet"], alpha=0.5)