plot_fit_resid

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

Plot the fit results, and the residuals, for a data set.

This creates two plots - the first from plot_fit and the second from plot_resid - for a data set.

Changed in version 4.12.0: The Y axis of the residual plot is now always drawn using a linear scale.

Parameters
  • id (int or str, optional) – The data set. If not given then the default identifier is used, as returned by get_default_id.

  • replot (bool, optional) – Set to True to use the previous values. The default is False.

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

Raises

sherpa.utils.err.IdentifierErr – If the data set does not exist or a source expression has not been set.

See also

get_fit_plot()

Return the data used to create the fit plot.

get_default_id()

Return the default data set identifier.

plot()

Create one or more plot types.

plot_fit()

Plot the fit results for a data set.

plot_fit_delchi()

Plot the fit results, and the residuals, for a data set.

plot_fit_ratio()

Plot the fit results, and the ratio of data to model, for a data set.

plot_data()

Plot the data values.

plot_model()

Plot the model for a data set.

plot_resid()

Plot the residuals (data - model) 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_fit_resid are the same as the keywords of the dictionary returned by get_data_plot_prefs, and are applied to both plots.

For the residual plot, the ylog setting is ignored, and the Y axis is drawn using a linear scale.

Examples

Plot the results for the default data set:

>>> plot_fit_resid()

Overplot the ‘core’ results on those from the ‘jet’ data set, using a logarithmic scale for the X axis:

>>> set_xlog()
>>> plot_fit_resid('jet')
>>> plot_fit_resid('core', 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_data_plot_prefs. The following sets the data in both plots to be drawn in a blue color, have caps on the error bars, but to only draw the y error bars:

>>> plot_fit_resid(capsize=4, color='skyblue', xerrorbars=False)