Last modified: December 2023

AHELP for CIAO 4.16 Sherpa


Context: plotting


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


plot_fit_resid(id=None, replot=False, overplot=False, clearwindow=True,

id - int or str, optional
replot - bool, optional
overplot - bool, optional
clearwindow - bool, optional


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


Example 1

Plot the results for the default data set:

>>> plot_fit_resid()

Example 2

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)

Example 3

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)


The parameters for this function are:

Parameter Definition
id The data set. If not given then the default identifier is used, as returned by `get_default_id` .
replot Set to True to use the previous values. The default is False .
overplot If True then add the data to an existing plot, otherwise create a new plot. The default is False .
clearwindow Should the existing plot area be cleared before creating this new plot (e.g. for multi-panel plots)?


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.

Changes in CIAO

Changed in CIAO 4.13

The overplot option now works.

Changed in CIAO 4.12

The Y axis of the residual plot is now always drawn using a linear scale.


See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.

See Also

get_data_prof, get_data_prof_prefs, get_delchi_prof, get_delchi_prof_prefs, get_fit_prof, get_model_prof, get_model_prof_prefs, get_resid_prof, get_resid_prof_prefs, get_source_prof, get_source_prof_prefs, plot_chart_spectrum, plot_marx_spectrum, prof_data, prof_delchi, prof_fit, prof_fit_delchi, prof_fit_resid, prof_model, prof_resid, prof_source
get_arf_plot, get_bkg_chisqr_plot, get_bkg_delchi_plot, get_bkg_fit_plot, get_bkg_model_plot, get_bkg_plot, get_bkg_ratio_plot, get_bkg_resid_plot, get_bkg_source_plot
fit, simulfit
get_iter_method_name, get_iter_method_opt, list_iter_methods, set_iter_method, set_iter_method_opt
normal_sample, t_sample, uniform_sample
get_cdf_plot, get_energy_flux_hist, get_pdf_plot, get_photon_flux_hist, get_pvalue_plot, get_pvalue_results, get_split_plot, plot, plot_arf, plot_bkg, plot_bkg_chisqr, plot_bkg_delchi, plot_bkg_fit, plot_bkg_fit_delchi, plot_bkg_fit_resid, plot_bkg_model, plot_bkg_ratio, plot_bkg_resid, plot_bkg_source, plot_cdf, plot_chisqr, plot_data, plot_delchi, plot_energy_flux, plot_fit, plot_fit_delchi, plot_fit_ratio, plot_model, plot_model_component, plot_order, plot_pdf, plot_photon_flux, plot_pvalue, plot_ratio, plot_resid, plot_scatter, plot_source, plot_source_component, plot_trace, set_xlinear, set_xlog, set_ylinear, set_ylog
get_chisqr_plot, get_delchi_plot, get_stat, get_stat_name
calc_chisqr, calc_stat
contour_resid, image_fit