CDFPlot

class sherpa.plot.CDFPlot[source] [edit on github]

Bases: Plot

Display the cumulative distribution of an array.

The cumulative distribution of the data is drawn along with vertical lines to indicate the median, 15.87%, and 84.13% percentiles.

See also

PDFPlot

Examples

Show the cumulative distribution of 1000 randomly-distributed points from a Gumbel distribution:

>>> rng = np.random.default_rng()  # requires NumPy 1.17 or later
>>> pts = rng.gumbel(loc=100, scale=20, size=1000)
>>> plot = CDFPlot()
>>> plot.prepare(pts)
>>> plot.plot()

Attributes Summary

lower_defaults

The options used to draw the 15.87% line.

median_defaults

The options used to draw the median line.

plot_prefs

The plot options (the CDF and axes).

upper_defaults

The options used to draw the 84.13% line.

Methods Summary

hline(y[, xmin, xmax, linecolor, linestyle, ...])

Draw a line at constant y, extending over the plot.

overplot(*args, **kwargs)

Add the data to an existing plot.

plot([overplot, clearwindow])

Plot the data.

prepare(points[, xlabel, name])

Create the data to plot.

vline(x[, ymin, ymax, linecolor, linestyle, ...])

Draw a line at constant x, extending over the plot.

Attributes Documentation

lower_defaults = {'linecolor': 'blue', 'linestyle': 'dash', 'linewidth': 1.5}

The options used to draw the 15.87% line.

median_defaults = {'linecolor': 'orange', 'linestyle': 'dash', 'linewidth': 1.5}

The options used to draw the median line.

plot_prefs = {}

The plot options (the CDF and axes).

upper_defaults = {'linecolor': 'blue', 'linestyle': 'dash', 'linewidth': 1.5}

The options used to draw the 84.13% line.

Methods Documentation

static hline(y, xmin=0, xmax=1, linecolor=None, linestyle=None, linewidth=None, overplot=False, clearwindow=True) [edit on github]

Draw a line at constant y, extending over the plot.

overplot(*args, **kwargs) [edit on github]

Add the data to an existing plot.

This is the same as calling the plot method with overplot set to True.

See also

plot

plot(overplot=False, clearwindow=True, **kwargs)[source] [edit on github]

Plot the data.

This will plot the data sent to the prepare method.

Parameters
  • overplot (bool, optional) – If True then add the data to an existing plot, otherwise create a new plot.

  • clearwindow (bool, optional) – Should the existing plot area be cleared before creating this new plot (e.g. for multi-panel plots)?

  • **kwargs – These values are passed on to the plot backend, and must match the names of the keys of the object’s plot_prefs dictionary.

See also

prepare, overplot

prepare(points, xlabel='x', name='x')[source] [edit on github]

Create the data to plot.

Parameters
  • points – The values to display (they do not have to be sorted).

  • xlabel (optional, string) – The label for the X axis.

  • name (optional, string) – Used to create the Y-axis label and plot title.

See also

plot

static vline(x, ymin=0, ymax=1, linecolor=None, linestyle=None, linewidth=None, overplot=False, clearwindow=True) [edit on github]

Draw a line at constant x, extending over the plot.