Histograms

A histogram is a graphical representation of the distribution of data. It is an estimate of the probability distribution of a continuous variable (quantitative variable) and was first introduced by Karl Pearson. To construct a histogram, the first step is to "bin" the range of values—that is, divide the entire range of values into a series of small intervals—and then count how many values fall into each interval. A rectangle is drawn with height proportional to the count and width equal to the bin size, so that rectangles abut each other. A histogram may also be normalized displaying relative frequencies. It then shows the proportion of cases that fall into each of several categories, with the sum of the heights equaling 1. The bins are usually specified as consecutive, non-overlapping intervals of a variable. The bins (intervals) must be adjacent, and usually equal size.

Statistics

You can get detailed statistics on a given histogram using the method getStat(). It returns a map (for JAVA) or Python dictionary (for Jython)
where each statistical characteristics can be accessed using a key,
such as mean, RMS, variance, error on the mean at.

Histogram input/output

As any object in ScaVis, you can serialize histogram into a file and then read it back.
Read IO section. Here we show a simple example how to write a histogram into
a human-readable text file (jdat) and then read it back.

Histogram operations

The histogram classes support many mathematical operations (division, subtraction, multiplication, scaling, shifting, smoothing etc).
Histogram arithmetic can be done with the method “oper(h,”New Title“,”operation“)”, where “h” is an object represented a histogram
which is used to subtract, divide, multiply and add. All these operations should be defined by a string operation as “-, /, *, +”,
and the histograms must have the same binning.
It should also be noted that all such operations take into account propagation of statistical errors for each bin assuming that histograms
do not correlate.

A histogram can be scaled by a constant using the method “operScale(title,scaleFactor)”

Jython scripting using histograms

Instead of calling Java classes using the Jython (or Python) language, one can use the native Jython classes based on the Java classes.
In this case, many Java methods can conveniently be overloaded. For example, histograms can be added, subtracted, divided and multiplied
using the conventional arithmetic operators “+,-,/,*”. To be able to use Python-derived classes for the histogram objects, import the class “shplot” (“scripting” HPlot package). The histogram classes have the same names, but they start from a lower case. Let us give an example: