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_psfor 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:
id (int, 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.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
Trueto use the values calculated by the last call toplot_source. The default isFalse.overplot (bool, optional) – If
Truethen 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)?
See also
get_source_plotReturn the data used by plot_source.
get_default_idReturn the default data set identifier.
plotCreate one or more plot types.
plot_modelPlot the model for a data set.
set_analysisSet the units used when fitting and displaying spectral data.
set_xlinearNew plots will display a linear X axis.
set_xlogNew plots will display a logarithmically-scaled X axis.
set_ylinearNew plots will display a linear Y axis.
set_ylogNew 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_analysiscommand. 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()