hist (replaces THistogram)
The hist function returns the histogram of an array using the CHistogram class with default parameters.
histogram_table = hist( tbl )
tbl is the 1-dimensional array of sample points.
histogram_table is the returned 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. It also could be compacted into a single line by removing the return value h containing the table of histogram frequencies. Note in the example below that the hist function automatically chooses the number of bins for the data, and an x-axisarray must be created with the number of elements equal to the number of bins. This script shows how to do that.
|
-- compute the histogram |
|
-- use the automatic binning |
|
|
|
|
|
-- create an x axis |
|
-- make a line plot |
CHistogram Class, Table and Array Functions, histplot, series, gaussdev
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics,
Inc. All Rights Reserved.