Package igraph :: Module statistics :: Class Histogram
[hide private]
[frames] | no frames]

Class Histogram



object --+
         |
        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.000,  5.000): ****
[ 5.000, 10.000): ******


Instance Methods [hide private]
  __init__(self, bin_width=1, data=[])
Initializes the histogram with the given data set.
  __lshift__(self, data)
Adds a single number or elements of an iterable to the histogram.
  __plot__(self, context, bbox, palette, *args, **kwds)
Plotting support
  __str__(self)
Returns the string representation of the histogram
  _get_bin(self, num, create=False)
Returns the bin index corresponding to the given number.
  _get_mean(self)
  _get_n(self)
  _get_sd(self)
  _get_var(self)
  add(self, num, repeat=1)
Adds a single number to the histogram.
  add_many(self, data)
Adds a single number or elements of an iterable to the histogram.
  bins(self)
Generator returning the bins of the histogram in increasing order
  clear(self)
Clears the collected data

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__


Properties [hide private]
  mean
Mean of the elements
  n
Number of elements in the histogram
  sd
Standard deviation of the elements
  var
Variance of the elements

Inherited from object: __class__


Method Details [hide private]

__init__(self, bin_width=1, data=[])
(Constructor)

 
Initializes the histogram with the given data set.
Parameters:
  • bin_width - the bin width of the histogram.
  • data - the data set to be used. Must contain real numbers.
Overrides: object.__init__

__lshift__(self, data)

 
Adds a single number or elements of an iterable to the histogram.
Parameters:
  • data - the data to be added

__plot__(self, context, bbox, palette, *args, **kwds)

 
Plotting support

__str__(self)
(Informal representation operator)

 
Returns the string representation of the histogram
Overrides: object.__str__

_get_bin(self, num, create=False)

 
Returns the bin index corresponding to the given number.
Parameters:
  • num - the number for which the bin is being sought
  • create - whether to create a new bin if no bin exists yet.
Returns:
the index of the bin or None if no bin exists yet and {create} is False.

_get_mean(self)

 
None

_get_n(self)

 
None

_get_sd(self)

 
None

_get_var(self)

 
None

add(self, num, repeat=1)

 
Adds a single number to the histogram.
Parameters:
  • num - the number to be added
  • repeat - number of repeated additions

add_many(self, data)

 
Adds a single number or elements of an iterable to the histogram.
Parameters:
  • data - the data to be added

bins(self)

 
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

clear(self)

 
Clears the collected data

Property Details [hide private]

mean

Mean of the elements
Get Method:
igraph.statistics.Histogram._get_mean(self)
Set Method:
None                                                                  
Delete Method:
None                                                                  

n

Number of elements in the histogram
Get Method:
igraph.statistics.Histogram._get_n(self)
Set Method:
None                                                                  
Delete Method:
None                                                                  

sd

Standard deviation of the elements
Get Method:
igraph.statistics.Histogram._get_sd(self)
Set Method:
None                                                                  
Delete Method:
None                                                                  

var

Variance of the elements
Get Method:
igraph.statistics.Histogram._get_var(self)
Set Method:
None                                                                  
Delete Method:
None