hist (replaces THistogram)
The hist function returns a table containing the histogram of an array using default binning parameters. It does not return a CHistogram object. If a plotted histogram is desired, you could also use the histplot function which reveals the abscissa values on the plotted x-axis. For computing a histogram with complete access to the input data and binning parameters, use the CHistogram class.
histogram_table = hist( tbl )
tbl is the 1-dimensional array of sample points.
histogram_table is returned as a 1-dimensional array containing the histogram frequencies.
On failure, nil is returned.
This function expedites histogram calculation when you do not need to set specific histogramming parameters. The function uses the default settings of the CHistogram class, which include a bin count of the lesser of the square root of the number of sample points and 100.
The following script computes and plots a histogram of 1 million Gaussian random numbers. In the script, note that the # operator returns the number of table elements.
|
-- return a table with a histogram of gaussian deviates |
|
-- create an x axis |
|
-- make a step-line plot showing a nice Gaussian curve |
stepline
Mira Pro x64 Script User's Guide, v.8.73 Copyright Ⓒ 2024
Mirametrics, Inc. All Rights Reserved.