plot_model
- sherpa.astro.ui.plot_model(id: IdType | None = None, replot=False, overplot=False, clearwindow=True, **kwargs) None
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, 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.replot (bool, optional) – Set to
Trueto use the values calculated by the last call toplot_model. 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_model_plotReturn the data used to create the model plot.
get_model_plot_prefsReturn the preferences for plot_model.
get_default_idReturn the default data set identifier.
plotCreate one or more plot types.
plot_model_componentPlot a component of the model for a data set.
plot_sourcePlot the source expression for a data set.
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.
Notes
The additional arguments supported by
plot_modelare the same as the keywords of the dictionary returned byget_model_plot_prefs.For PHA data sets the model plot created by
plot_modeldiffers to the model plot created byplot_fit: the fit version uses the grouping of the data set whereas theplot_modelversion 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')