sherpa.astro.ui.plot_source(id=None, lo=None, hi=None, replot=False, overplot=False, clearwindow=True, **kwargs)

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).

  • 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.

  • lo (number, optional) – The low value to plot (only used for PHA data sets).

  • hi (number, optional) – The high value to plot (only use for PHA data sets).

  • replot (bool, optional) – Set to True to use the values calculated by the last call to plot_source. The default is False.

  • overplot (bool, optional) – If True then add the data to an exsiting plot, otherwise create a new plot. The default is False.

  • clearwindow (bool, optional) – Should the existing plot area be cleared before creating this new plot (e.g. for multi-panel plots)?

See also


Return the data used by plot_source.


Return the default data set identifier.


Create one or more plot types.


Plot the model for a data set.


Set the units used when fitting and displaying spectral data.


New plots will display a linear X axis.


New plots will display a logarithmically-scaled X axis.


New plots will display a linear Y axis.


New plots will display a logarithmically-scaled Y axis.


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)

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()