plot_model_components

sherpa.astro.ui.plot_model_components(id: IdType | None = None, overplot=False, clearwindow=True, **kwargs) None

Plot all the components of a model.

Display the individual model components of a source expression.

Changed in version 4.17.0: The keyword arguments can now be set per plot by using a sequence of values.

Added in version 4.16.1.

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.

  • overplot (bool, optional) – If True then add the data to an existing plot, otherwise create a new plot. The default is False. This is only used for the first component.

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

Notes

The additional keyword arguments match the keywords of the dictionary returned by get_model_plot_prefs.

Examples

Display two plots, the first for the gal * pl component and the second for gal * line:

>>> set_source(xsphabs.gal * (powlaw1d.pl + xsgaussian.line))
>>> plot_model_components(alpha=0.6)

Plot the combined model and then overplot the two components in black, partly opaque, and using dotted and dashed line styles:

>>> plot_model(label="combined")
>>> plot_model_components(overplot=True, color="black",
...                       linestyle=["dotted", "dashed"],
...                       label=["model 1", "model 2"],
...                       alpha=0.5)