Recent Changes - Search:

Information Foreword What is EJS? Demos/Examples Credits Links Webcasts Installation Download & Install EJS Workspaces Running EJS Conditions of Use Documentation EJS Console EJS Interface Description Panel Model Panel View Panel Deployment Elements Reference User Feedback English | Spanish | ? View Edit History Print PDF ## Histogram A histogram is a drawable that displays the cumulative occurrences of given input values in the form of a histogram (a graph of bars or of points). The input values and its occurrences can be specified using the Input and Occurrences properties, or can be added to the histogram using the different forms of the append method. A given input value creates a new bin (vertical bar or point) with the height of the given occurrence, or adds to the height of an existing bin if the input’s distance to the value of this bin is smaller than the bin width of the histogram. The occurrences can be normalized, in which case the values are taken as percentage of the sum of all input occurrences. Click on the image to start the applet. A simple Histogram example: the Input property of a normalized histogram is used to plot the probability mass function of the binomial distribution. Download this example. If the simulation has Data processing tools added to it, an histogram will add an entry to the simulation menu. ## Properties Property values in the Histogram inspector
Histogram
Configuration
Points are usually added to the histogram using the Input and Occurrences properties. The input can be a single double value or an array of double values. This latter option is use typically when you compute the whole histogram in your code and want to update it all at once. In this case, you can set the Clear at Input property to true, so that adding the computed values clears first the previous histogram (instead of adding to the existing occurrences).
Name | Description | Values accepted | Default
Input | The double or double[] input value to append. | A constant or variable of type int, double or double[]. |
Enabled | Whether the histogram actually accepts input values. | A boolean variable or one of the constants `true` or `false`. | `true`
Occurrences | The number of the occurrences of the input. | A constant or variable of type int or double. | 1
Clear at Input | Whether to clear old data whenever new data gets in. | A boolean variable or one of the constants `true` or `false`. | `false`
‘’‘Discrete | Whether the bins are discrete or continuous. A discrete bin looks like a thin vertical line, a continuous one looks like a bar with the width of the bin. | A boolean variable or one of the constants `true` or `false`. | `true`
Normalized | Whether the data are normalized to one. | A boolean variable or one of the constants `true` or `false`. | `false`
Graphical Aspect
Name | Description | Values accepted | Default
Bin Offset | The offset (horizontal displacement) for the bins. If the input value is, say, 1, the corresponding bin is displayed at 1+offset. | A constant or variable of type int or double. | 0
Bin Width | The width of the bins. This is the maximum distance that makes two inputs contribute to the same bin height. As an example, is the with is 0.5, the inputs 1.1 and 1.4 will add their occurrences to the same bin. | A constant or variable of type int or double. | 1
Bin Style | The style for the bins. | Enter POINT (for a point plot) or BIN (for vertical bars) or use the editor provided to make a choice. You can also use the integer constants `org.opensourcephysics.display.Histogram.DRAW_POINT` and `org.opensourcephysics.display.Histogram.DRAW_BIN`. | BIN
Bar Offset | The offset for the bar. This adds a constant displacement to the input value. Hence, an input of 1 will add to the bin at 1+offset. | A constant or variable of type int or double. | 0
Line Color | The color used for the lines of the element. | Use the editor provided or read about colors. | BLACK
Fill Color | The color used to fill the points or bars of the histogram. | Use the editor provided or read about colors. | BLUE
## Public methods of the Histogram element that can be invoked in a code page
Signature and description
`void append(double value, double numberOfoccurrences)`. Append a value with number of occurrences to the Histogram.
`void append(double value)`. Equivalent to void append(double value,1).
`void append(double[] values)`. Appends an array of values with 1 occurrence.
`void clear()`. Clears all data from this histogram and resets min and max values.

Edit - History - Print - Recent Changes - Search
Page last modified on June 09, 2009, at 07:40 PM