Last modified: December 2020

URL: https://cxc.cfa.harvard.edu/sherpa/ahelp/plot.html
AHELP for CIAO 4.13 Sherpa v1

plot

Context: plotting

Synopsis

Create one or more plot types.

Syntax

plot(*args, **kwargs)

Description

The plot function creates one or more plots, depending on the arguments it is sent: a plot type, followed by optional identifiers, and this can be repeated. If no data set identifier is given for a plot type, the default identifier - as returned by `get_default_id` - is used.


Examples

Example 1

Plot the data for the default data set. This is the same as `plot_data` .

>>> plot("data")

Example 2

Plot the data for data set 2.

>>> plot("data", 2)

Example 3

Plot the data and ARF for the default data set, in two seaparate plots.

>>> plot("data", "arf")

Example 4

Plot the fit (data and model) for data sets 1 and 2, in two separate plots.

>>> plot("fit", 1, "fit", 2)

Example 5

Plot the fit (data and model) for data sets "fit" and "jet", in two separate plots.

>>> plot("fit", "nucleus", "fit", "jet")

Example 6

Draw the data and model plots both with a log-scale for the y axis:

>>> plot("data", "model", ylog=True)

Example 7

Plot the backgrounds for dataset 1 using the 'up' and 'down' components (in this case the background identifier):

>>> plot('bkg', 1, 'up', 'bkg', 1, 'down')

Notes

The supported plot types depend on the data set type, and include the following list. There are also individual functions, with plot_ prepended to the plot type, such as `plot_data` (the bkg variants use a prefix of plot_bkg_ ). There are also several multiple-plot commands, such as `plot_fit_ratio` , `plot_fit_resid` , and `plot_fit_delchi` .

Item Definition
arf The ARF for the data set (only for `DataPHA` data sets).
bkg The background.
bkgchisqr The chi-squared statistic calculated for each bin when fitting the background.
bkgdelchi The residuals for each bin, calculated as (data-model) divided by the error, for the background.
bkgfit The data (as points) and the convolved model (as a line), for the background data set.
bkgmodel The convolved background model.
bkgratio The residuals for each bin, calculated as data/model, for the background data set.
bkgresid The residuals for each bin, calculated as (data-model), for the background data set.
bkgsource The un-convolved background model.
chisqr The chi-squared statistic calculated for each bin.
data The data (which may be background subtracted).
delchi The residuals for each bin, calculated as (data-model) divided by the error.
fit The data (as points) and the convolved model (as a line).
kernel The PSF kernel associated with the data set.
model The convolved model.
psf The unfiltered PSF kernel associated with the data set.
ratio The residuals for each bin, calculated as data/model.
resid The residuals for each bin, calculated as (data-model).
source The un-convolved model.

The plots can be specialized for a particular data type, such as the `set_analysis` command controlling the units used for PHA data sets.

See the documentation for the individual routines for information on how to configure the plots.

The plot capabilities depend on what plotting backend, if any, is installed. If there is none available, a warning message will be displayed when `sherpa.ui` or `sherpa.astro.ui` is imported, and the `plot` set of commands will not create any plots. The choice of back end is made by changing the options.plot_pkg setting in the Sherpa configuration file.

The keyword arguments are sent to each plot (so care must be taken to ensure they are valid for all plots).

Changes in CIAO

Changed in CIAO 4.13

Keyword arguments, such as alpha and ylog, can be sent to each plot.


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
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_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_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
visualization
contour_resid