plot/
plot_binneddata.pro
top source plot_binneddata
Plot
plot_binneddata, X, DATA, BIN, MIN=MIN, MAX=MAX, ERRORBAR=ERRORBAR, OVERPLOT=OVERPLOT, NOPLOT=NOPLOT, OX=OX, ODATA=ODATA, OERR=OERR, COLOR=COLOR, DX=DX, MEDIAN=MEDIAN, HORIZONTALBAR=HORIZONTALBAR, CONFLIMIT=CONFLIMIT, ROBUST=ROBUST, HISTOGRAM=HISTOGRAM, REVERSE_INDICES=REVERSE_INDICES, _EXTRA=_EXTRA, WINDOW=WINDOW, ADDCMD=ADDCMD
Takes a set of X,Y data and plots the mean y value for points binned by their x coordinate.
Parameters
- X in
Array containing x coordinates of data points.
- DATA in
Array containing y coordinates of data points.
- BIN in
Bin width, in x coordinates (if positive) or in data points per bin (if negative).
Keywords
- MIN in
Minimum value for bins. Default: minimum value of X.
- MAX in
Maximum value for bins. Default: maximum value of X.
- ERRORBAR in
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).
- OVERPLOT in
If /OVERPLOT is set then overplot binned data points on an existing plot.
- NOPLOT in
If /NOPLOT is set then do not create a plot. Useful if you just want to extract the values using the O... keywords.
- OX in
Optional output of x coordinates of bins.
- ODATA in
Optional output of plotted y values.
- OERR in
Optional output 2xNbin array containg the ends of the error bars.
- COLOR in
Color of plotted points and error bars.
- DX in
Shifts the x coordinates of the plot locations (only on the plot, not in OX).
- MEDIAN in
If /MEDIAN is set then plot the median Y value instead of the mean.
- HORIZONTALBAR in
If /HORIZONTALBAR is set then the routine plots a horizontal line that spans each bin.
- CONFLIMIT in
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.
- ROBUST in
If /ROBUST is set then use ROBUST_MEAN to calculate the mean Y value. Not compatible with /MEDIAN.
- HISTOGRAM in
Outputs the histogram of number of Data values that contributed to each bin. Not compatible with negative values for Bin.
- REVERSE_INDICES in
Outputs the reverse indices of the histogram. Not compatible with negative values for Bin.
- _EXTRA in
Extra keywords are passed through to CGPLOT.
- WINDOW in
Sets the /WINDOW keyword in Coyote Graphics.
- ADDCMD in
Sets the /ADDCMD keyword in Coyote Graphics.
Examples
x = 0.1*FINDGEN(20)
y = 10. * x^2 + RANDOMN(seed, 20)
PLOT, PSYM=3, x, y
PLOT_BINNEDDATA, x, y, -4, /OVERPLOT, /ERRORBAR
Author information
- 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.
File attributes
| Modification date: | Fri Mar 11 14:12:12 2011 |
| Lines: | 195 |
![[attach.png]](../idldoc-resources/attach.png)