Synopsis
Plot the fit results (data, model) for a data set.
Syntax
plot_fit(id=None, replot=False, overplot=False, clearwindow=True, **kwargs)
Description
This function creates a plot containing the data and the model (including any instrument response) for a data set.
Examples
Example 1
Plot the fit results for the default data set:
>>> plot_fit()
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('jet') >>> plot_fit('core', overplot=True)
Example 3
Keyword arguments can be given to override the plot preferences; for example the following sets the y axis to a log scale, but only for this plot:
>>> plot_fit(ylog=True)
Example 4
The color can be changed for both the data and model using (note that the keyword name and supported values depends on the plot backend; this example assumes that Matplotlib is being used):
>>> plot_fit(color='orange')
Example 5
Draw the fits for two datasets, setting the second one partially transparent (this assumes Matplotlib is used):
>>> plot_fit(1) >>> plot_fit(2, alpha=0.7, overplot=True)
PARAMETERS
The parameters for this function are:
Parameter | Type information | Definition |
---|---|---|
id | int, str, or None, 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 values calculated by the last call to `plot_fit` . The default is False . |
overplot | bool, optional | If True then add the data to an existing 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)? |
Notes
The additional arguments supported by `plot_fit` are the same as the keywords of the dictionary returned by `get_data_plot_prefs` .
Bugs
See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.
See Also
- contrib
- 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
- data
- 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
- fitting
- fit, simulfit
- methods
- get_iter_method_name, get_iter_method_opt, list_iter_methods, set_iter_method, set_iter_method_opt
- modeling
- normal_sample, t_sample, uniform_sample
- plotting
- 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_delchi, plot_fit_ratio, plot_fit_resid, 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
- psfs
- plot_kernel
- statistics
- get_chisqr_plot, get_delchi_plot, get_stat, get_stat_name
- utilities
- calc_chisqr, calc_stat
- visualization
- contour_resid, image_fit