plot_source_components

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

Plot all the components of a source.

Display the individual 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:
idint, 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.

overplotbool, 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.

clearwindowbool, 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.

See also

get_source_component_plots, plot_model_components, plot_source_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_source_components(alpha=0.6)

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

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