get_source_plot
- sherpa.ui.get_source_plot(id: IdType | None = None, recalc: bool = True, copy: bool = True)
Return the data used to create the source plot.
Changed in version 4.19.0: The plot object is now copied by default. To get the previous behaviour set the
copyattribute toFalse.- Parameters:
- id
int,str,orNone,optional The data set that provides the data. If not given then the default identifier is used, as returned by
get_default_id.- recalcbool,
optional If
Falsethen the results from the last call toplot_source(orget_source_plot) are returned, otherwise the data is re-generated.- copybool,
optional Is the plot object copied before being returned? If so then the plot attributes will not be changed by multiple calls to this routine.
- id
- Returns:
instanceAn object representing the data used to create the plot by
plot_source. The return value depends on the data set (e.g. 1D binned or un-binned).
See also
get_model_plotReturn the data used to create the model plot.
plot_modelPlot the model for a data set.
plot_sourcePlot the source expression for a data set.
Examples
Retrieve the source plot information for the default data set and then display it:
>>> splot = get_source_plot() >>> print(splot)
Return the plot data for data set 2, and then use it to create a plot:
>>> s2 = get_source_plot(2) >>> s2.plot()
Display the two source plots for the ‘jet’ and ‘core’ datasets on the same plot:
>>> splot1 = get_source_plot(id='jet') >>> splot2 = get_source_plot(id='core') >>> splot1.plot() >>> splot2.overplot()