C-PLOT

Scientific Graphics and Data Analysis

C.9. - hist.4



Hist.4 is simple user function that takes your data and generates new points to draw a histogram.
fn hist.4
or
fn hist.4 bins [min max]
The histogram will be a plot of the frequency of occurrence of the x values within equally spaced intervals (or bins). You can choose the starting value of the first bin, the end value of the last bin and the number of bins.

The function first sorts your data by the x values. You are then presented with the minimum and maximum. You may select different values -- usually you will want values rounded to an integer.

By default, the program selects the number of bins to be the difference between the minimum and maximum rounded to an integer (or the difference times increasing powers of 10, until the result is greater than 0). You can use that value or enter another.

You can enter just the number of bins on the command line, in which case the data minimum and maximum values will be used, or you can enter the number of bins and the minimum and maximum values on the command line.

When the function returns, draw the current points with a solid line (symbol L) to obtain the histogram. Of course, in the process of generating the histogram your data points are lost from memory.