plot_fit_ratio¶
- sherpa.astro.ui.plot_fit_ratio(id=None, replot=False, overplot=False, clearwindow=True, **kwargs)¶
Plot the fit results, and the ratio of data to model, for a data set.
This creates two plots - the first from plot_fit and the second from plot_ratio - for a data set.
Changed in version 4.12.2: The
overplotoption now works.New in version 4.12.0.
- 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
Trueto use the values calculated by the last call to plot_fit_ratio. The default isFalse.overplot (bool, optional) – If
Truethen add the data to an existing plot, otherwise create a new plot. The default isFalse.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_plotReturn the data used to create the fit plot.
get_default_idReturn the default data set identifier.
plotCreate one or more plot types.
plot_fitPlot the fit results for a data set.
plot_fit_residPlot the fit results, and the residuals, for a data set.
plot_fit_delchiPlot the fit results, and the residuals, for a data set.
plot_dataPlot the data values.
plot_modelPlot the model for a data set.
plot_ratioPlot the ratio of data to model for a data set.
set_xlinearNew plots will display a linear X axis.
set_xlogNew plots will display a logarithmically-scaled X axis.
set_ylinearNew plots will display a linear Y axis.
set_ylogNew plots will display a logarithmically-scaled Y axis.
Notes
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.
Examples
Plot the results for the default data set:
>>> plot_fit_ratio()
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)
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')