PLOT_BINNEDDATA
Name
PLOT_BINNEDDATA
Purpose
Takes a set of X,Y data and plots the mean y value for points
binned by their x coordinate.
Category
Plot
Calling Sequence
PLOT_BINNEDDATA, X, Data, Bin
Inputs
X: Array containing x coordinates of data points.
Data: Array containing y coordinates of data points.
Bin: Bin width, in x coordinates (if positive) or in
data points per bin (if negative).
Keyword Parameters
MIN: Minimum value for bins. Default: minimum value of X.
MAX: Maximum value for bins. Default: maximum value of X.
OX: Optional output of x coordinates of bins.
ODATA: Optional output of plotted y values.
OERR: Optional output 2xNbin array containg the ends of the
error bars.
DX: Shifts the x coordinates of the plot locations (only on
the plot, not in OX).
ERRORBAR: If /ERRORBAR is set, then error bars are plotted in the y
direction. The size of the error bar is the statistical
error in the mean (or, if /MEDIAN is set, the range
containing the fraction CONFLIMIT of the data).
CONFLIMIT: Fraction of the data to enclose in the error bar if
/MEDIAN is set. For example, use CONFLIMIT=0.9 to
plot the 5th to 95th percentile range.
MEDIAN: If /MEDIAN is set then plot the median Y value instead
of the mean.
ROBUST: If /ROBUST is set then use ROBUST_MEAN to calculate the
mean Y value. Not compatible with /MEDIAN.
HORIZONTALBAR: If /HORIZONTALBAR is set then the routine plots a
horizontal line that spans each bin.
OVERPLOT: If /OVERPLOT is set then overplot binned data points on
an existing plot.
NOPLOT: If /NOPLOT is set then do not create a plot. Useful if
you just want to extract the values using the O...
keywords.
COLOR: Color of plotted points and error bars.
HISTOGRAM: Outputs the histogram of number of Data values that
contributed to each bin. Not compatible with negative
values for Bin.
REVERSE_INDICES: Outputs the reverse indices of the histogram.
Not compatible with negative values for Bin.
WINDOW: Sets the /WINDOW keyword in Coyote Graphics.
ADDCMD: Sets the /ADDCMD keyword in Coyote Graphics.
_Extra: Extra keywords are passed through to CGPLOT.
Example
x = 0.1*FINDGEN(20)
y = 10. * x^2 + RANDOMN(seed, 20)
PLOT, PSYM=3, x, y
PLOT_BINNEDDATA, x, y, -4, /OVERPLOT, /ERRORBAR
Modification History
Written by: Jeremy Bailin
12 June 2008 Public release in JBIU
3 May 2009 When BIN<0, make all bins have approximately the
same number of elements instead of sticking any
excess elements in the final bin.
12 July 2010 Added /ROBUST keyword.
31 July 2010 Added HISTOGRAM and REVERSE_INDICES keywords.
11 March 2011 Switched to Coyote Graphics.