class documentation
class Histogram:
Generic histogram class for real numbers
Example:
>>> h = Histogram(5) # Initializing, bin width = 5 >>> h << [2,3,2,7,8,5,5,0,7,9] # Adding more items >>> print(h) N = 10, mean +- sd: 4.8000 +- 2.9740 [ 0, 5): **** (4) [ 5, 10): ****** (6)
| Method | __init__ |
Initializes the histogram with the given data set. |
| Method | __plot__ |
Plotting support |
| Method | __str__ |
Undocumented |
| Method | add |
Adds a single number to the histogram. |
| Method | add |
Adds a single number or the elements of an iterable to the histogram. |
| Method | bins |
Generator returning the bins of the histogram in increasing order |
| Method | clear |
Clears the collected data |
| Method | to |
Returns the string representation of the histogram. |
| Property | mean |
Returns the mean of the elements in the histogram |
| Property | n |
Returns the number of elements in the histogram |
| Property | sd |
Returns the standard deviation of the elements in the histogram |
| Property | var |
Returns the variance of the elements in the histogram |
| Method | _get |
Returns the bin index corresponding to the given number. |
| Instance Variable | _bin |
Undocumented |
| Instance Variable | _bins |
Undocumented |
| Instance Variable | _max |
Undocumented |
| Instance Variable | _min |
Undocumented |
| Instance Variable | _running |
Undocumented |
Initializes the histogram with the given data set.
| Parameters | |
| bin | the bin width of the histogram. |
| data | the data set to be used. Must contain real numbers. |
Adds a single number to the histogram.
| Parameters | |
| num | the number to be added |
| repeat | number of repeated additions |
Adds a single number or the elements of an iterable to the histogram.
| Parameters | |
| data | the data to be added |
Generator returning the bins of the histogram in increasing order
| Returns | |
| a tuple with the following elements: left bound, right bound, number of elements in the bin |
Returns the string representation of the histogram.
| Parameters | |
| max | the maximal width of each line of the string This value may not be obeyed if it is too small. |
| show | specify whether the histogram bars should be shown |
| show | specify whether the histogram counts should be shown. If both show_bars and show_counts are False, only a general descriptive statistics (number of elements, mean and standard deviation) is shown. |