Institut für Astronomie und AstrophysikAbteilung AstronomieSand 1, D-72076 Tübingen, Germany |
PLOTHIST
Plot the histogram of an array with the corresponding abcissa.
plothist, arr, xhist, yhist, [, BIN=, /FILL, /NOPLOT, /OVERPLOT, PEAK=, /AUTOBIN, ...plotting keywords]
arr - The array to plot the histogram of. It can include negative values, but non-integral values will be truncated.
xhist - X vector used in making the plot ( = lindgen( N_elements(h)) * bin + min(arr) ) yhist - Y vector used in making the plot (= histogram(arr/bin))
BIN - The size of each bin of the histogram, scalar (not necessarily integral). If not present (or zero), the bin size is set to 1. /AUTOBIN - Automatically determines bin size of the histogram as the square root of the number of samples. Only valid when BIN is not set. /HALFBIN - Set this keyword to a nonzero value to shift the binning by half a bin size. This is useful for integer data, where e.g. the bin for values of 6 will go from 5.5 to 6.5. The default is to set the HALFBIN keyword for integer data, and not for non-integer data. Note: prior to May 2002, the default was to always shift the binning by half a bin. /NAN - If set, then check for the occurence of IEEE not-a-number values /NOPLOT - If set, will not plot the result. Useful if intention is to only get the xhist and yhist outputs. /OVERPLOT - If set, will overplot the data on the current plot. User must take care that only keywords valid for OPLOT are used. PEAK - if non-zero, then the entire histogram is normalized to have a maximum value equal to the value in PEAK. If PEAK is negative, the histogram is inverted. /FILL - if set, will plot a filled (rather than line) histogram. The following keywords take effect only if the FILL keyword is set: FCOLOR - color to use for filling the histogram /FLINE - if set, will use lines rather than solid color for fill (see the LINE_FILL keyword in the POLYFILL routine) FORIENTATION - angle of lines for fill (see the ORIENTATION keyword in the POLYFILL routine) FPATTERN - the pattern to use for the fill (see the PATTERN keyword in the POLYFILL routine) FSPACING - the spacing of the lines to use in the fill (see the SPACING keyword in the POLYFILL routine) Any input keyword that can be supplied to the PLOT procedure (e.g. XRANGE, LINESTYLE) can also be supplied to PLOTHIST.
Create a vector of random 1000 values derived from a Gaussian of mean 0, and sigma of 1. Plot the histogram of these values with a bin size of 0.1 IDL> a = randomn(seed,1000) IDL> plothist,a, bin = 0.1
Written W. Landsman January, 1991 Add inherited keywords W. Landsman March, 1994 Use ROUND instead of NINT W. Landsman August, 1995 Add NoPlot and Overplot keywords. J.Wm.Parker July, 1997 Add Peak keyword. J.Wm.Parker Jan, 1998 Add FILL,FCOLOR,FLINE,FPATTERN,FSPACING keywords. J.Wm.Parker Jan, 1998 Converted to IDL V5.0 W. Landsman 21-Jan-1998 Add /NAN keyword W. Landsman October 2001 Don't plot out of range with /FILL, added HALFBIN keyword, make half bin shift default for integer only W. Landsman/J. Kurk May 2002
[Home Page] [Software, Documentation] [IDL Documentation] [Quick Reference] [Feedback]