Draws a histogram plot on the given workstation.
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" function gsn_histogram ( wks : graphic, data : numeric, res  : logical ) return_val  : graphic
The data for the histogram. The data must either be one-dimensional for a single histogram, or two-dimensional where two histogram fields are drawn.res
A variable containing an optional list of resources to apply to the histogram, attached as attributes. Set to True if you want the attached attributes to be applied, and False if you either don't have any resources to set, or you don't want the resources applied.
A scalar id of the histogram plot created is returned. In addition, several attributes are returned:
- NumInBins - an array of the number of items in each bin.
- BinLocs - an array of the values of the bin locations. This will be the end points of each bin if you have intervals, or the actual values if you have discrete values. Available in version 5.1.0 and later.
- NumMissing - the number of missing values (if any).
- Percentages - an array of percentages indicating the distribution of the bin values (missing values are counted in total)
- PercentagesNoMissing - an array of percentages indicating the distribution of the bin values (missing values are not counted in total)
- BeginBarLocs - an array indicating the X positions of the beginning location of each bar.
- MidBarLocs - an array indicating the X positions of the mid point location of each bar.
- EndBarLocs - an array indicating the X positions of the end location of each bar.
This function draws a histogram plot. Two histogram fields are drawn if data is two-dimensional. If missing values are encountered in data, then they are ignored.
If intervals are desired (instead of discrete values), then the values are counted as follows (assume there are n values, and thus n-1 bins):
value1 <= bin1 <= value2 < bin2 <= value3 ... valuen-1 < binn-1 <= valuenThere are many resources specific to this function. See the gsnHistogram resources for a full list.
To maximize the area that the plot is drawn in, set the special resource gsnMaximize to True.
If the user has a multidimensional array, say x(time,lat,lon), and a histogram of the entire array is desired, the function ndtooned may be used to reshape the array.
plot=gsn_histogram(wks,ndtooned(x),False)Further, if it is desired to plot a histogram for values between 30S and 30N latitude:
Special gsn resources
For some application examples, see the suite of histogram plot examples.