plot_model

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

Plot the model for a data set.

This function plots the model for a data set, which includes any instrument response (e.g. a convolution created by set_psf).

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.

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

  • overplot (bool, optional) – If True then add the data to an existing 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

get_model_plot

Return the data used to create the model plot.

get_model_plot_prefs

Return the preferences for plot_model.

get_default_id

Return the default data set identifier.

plot

Create one or more plot types.

plot_model_component

Plot a component of the model for a data set.

plot_source

Plot the source expression for a data set.

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.

Notes

The additional arguments supported by plot_model are the same as the keywords of the dictionary returned by get_model_plot_prefs.

For PHA data sets the model plot created by plot_model differs to the model plot created by plot_fit: the fit version uses the grouping of the data set whereas the plot_model version shows the ungrouped data (that is, it uses the instrumental grid). The filters used are the same in both cases.

Examples

Plot the convolved source model for the default data set:

>>> plot_model()

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

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

Create the equivalent of plot_fit('jet'):

>>> plot_data('jet')
>>> plot_model('jet', overplot=True)

Additional arguments can be given that are passed to the plot backend: the supported arguments match the keywords of the dictionary returned by get_model_plot_prefs. The following plots the model using a log scale for both axes, and then overplots the model from data set 2 using a dashed line and slightly transparent:

>>> plot_model(xlog=True, ylog=True)
>>> plot_model(2, overplot=True, alpha=0.7, linestyle='dashed')