Last modified: December 2023

AHELP for CIAO 4.16 Sherpa


Context: plotting


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


plot_fit_ratio(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_ratio` - for a data set.


Example 1

Plot the results for the default data set:

>>> plot_fit_ratio()

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_ratio('jet')
>>> plot_fit_ratio('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 plots to use square symbols (this includes the model as well as data in the top plot) and turns off any line between plots, when using the Matplotlib backend:

>>> plot_fit_ratio(marker='s', linestyle='none')


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 values calculated by the last call to `plot_fit_ratio` . 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_ratio` are the same as the keywords of the dictionary returned by `get_data_plot_prefs` , and are applied to both plots.

For the ratio 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.

Added in CIAO 4.12


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

See Also

plot_fit, plot_fit_delchi, plot_fit_resid