Last modified: December 2023

URL: https://cxc.cfa.harvard.edu/sherpa/ahelp/plot_data.html
Jump to: · Examples · PARAMETERS · Notes · Bugs · See Also


AHELP for CIAO 4.16 Sherpa

plot_data

Context: plotting

Synopsis

Plot the data values.

Syntax

plot_data(id=None, replot=False, overplot=False, clearwindow=True,
**kwargs)

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

Examples

Example 1

Plot the data from the default data set:

>>> plot_data()

Example 2

Plot the data from data set 1:

>>> plot_data(1)

Example 3

Plot the data from data set labelled "jet" and then overplot the "core" data set. The `set_xlog` command is used to select a logarithmic scale for the X axis.

>>> set_xlog("data")
>>> plot_data("jet")
>>> plot_data("core", overplot=True)

Example 4

The following example requires that the Matplotlib backend is selected, and uses a Matplotlib function to create a subplot (in this case one filling the bottom half of the plot area) and then calls `plot_data` with the `clearwindow` argument set to `False` to use this subplot. If the `clearwindow` argument had not been used then the plot area would have been cleared and the plot would have filled the area.

>>> plt.subplot(2, 1, 2)
>>> plot_data(clearwindow=False)

Example 5

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` . Examples include (for the Matplotlib backend): adding a "cap" to the error bars:

>>> plot_data(capsize=4)

changing the symbol to a square:

>>> plot_data(marker='s')

using a dotted line to connect the points:

>>> plot_data(linestyle='dotted')

and plotting multiple data sets on the same plot, using a log scale for the Y axis, setting the alpha transparency for each plot, and explicitly setting the colors of the last two datasets:

>>> plot_data(ylog=True, alpha=0.7)
>>> plot_data(2, overplot=True, alpha=0.7, color='brown')
>>> plot_data(3, overplot=True, alpha=0.7, color='purple')

PARAMETERS

The parameters for this function are:

Parameter Definition
id The data set that provides the data. 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_data` . 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)?

Notes

The additional arguments supported by `plot_data` 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
copy_data, dataspace1d, dataspace2d, datastack, delete_data, fake, get_arf_plot, get_axes, 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, get_counts, get_data, get_data_contour, get_data_contour_prefs, get_data_image, get_data_plot, get_data_plot_prefs, get_dep, get_dims, get_error, get_quality, get_specresp, get_staterror, get_syserror, group, group_adapt, group_adapt_snr, group_bins, group_counts, group_snr, group_width, load_ascii, load_data, load_grouping, load_quality, set_data, set_quality, ungroup, unpack_ascii, unpack_data
filtering
get_filter, load_filter, set_filter
info
get_default_id, list_data_ids, list_response_ids
modeling
clean, 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_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
saving
save_error, save_filter, save_grouping, save_quality, save_staterror, save_syserror
statistics
get_chisqr_plot, get_delchi_plot
utilities
calc_data_sum, calc_data_sum2d, calc_ftest, calc_kcorr, calc_mlr, calc_model_sum2d, calc_source_sum2d, get_rate
visualization
contour, contour_data, contour_ratio, contour_resid, histogram1d, histogram2d, image_data, rebin