plot_source

sherpa.astro.ui.plot_source(id: IdType | IdTypes | None = None, lo: float | None = None, hi: float | None = None, replot: bool = False, overplot: bool = False, clearwindow: bool = True, **kwargs) None

Plot the source expression for a data set.

This function plots the source model for a data set. This does not include any instrument response (e.g. a convolution created by set_psf or ARF and RMF automatically created 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.

lonumber, optional

The low value to plot (only used for PHA data sets).

hinumber, optional

The high value to plot (only use for PHA data sets).

replotbool, optional

Set to True to use the values calculated by the last call to plot_source. 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)?

See also

get_source_plot

Return the data used by plot_source.

get_default_id

Return the default data set identifier.

plot

Create one or more plot types.

plot_model

Plot the model for a data set.

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 unconvolved source model for the default data set:

>>> plot_source()

Overplot the source model for data set 2 on data set 1:

>>> plot_source(1)
>>> plot_source(2, overplot=True)

Overplot the source model for data set 2 in blue on data set 1 in green:

>>> plot_source([1, 2], color=["green", "blue"])

Restrict the plot to values between 0.5 and 7 for the independent axis:

>>> plot_source(lo=0.5, hi=7)

For a PHA data set, the units on both the X and Y axes of the plot are controlled by the set_analysis command. In this case the Y axis will be in units of photons/s/cm^2 and the X axis in keV:

>>> set_analysis('energy', factor=1)
>>> plot_source()