Package BIP :: Package Viz :: Module ascii :: Class Histogram
[hide private]
[frames] | no frames]

Class Histogram

source code

object --+
         |
        Histogram

Ascii histogram
Instance Methods [hide private]
 
__init__(self, data, bins=10)
Class constructor
source code
 
horizontal(self, height=4, character='|')
Returns a multiline string containing a a horizontal histogram representation of self.data
source code
 
vertical(self, height=20, character='|')
Returns a Multi-line string containing a a vertical histogram representation of self.data
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, data, bins=10)
(Constructor)

source code 
Class constructor
Parameters:
  • data - array like object
Overrides: object.__init__

horizontal(self, height=4, character='|')

source code 

Returns a multiline string containing a a horizontal histogram representation of self.data

>>> d = normal(size=1000)
>>> h = Histogram(d,bins=25)
>>> print h.horizontal(5,'|')
106            |||
              |||||
              |||||||
            ||||||||||
           |||||||||||||
-3.42                         3.09
Parameters:
  • height - Height of the histogram in characters
  • character - Character to use

vertical(self, height=20, character='|')

source code 

Returns a Multi-line string containing a a vertical histogram representation of self.data

>>> d = normal(size=1000)
>>> Histogram(d,bins=10)
>>> print h.vertical(15,'*')
                      236
-3.42:
-2.78:
-2.14: ***
-1.51: *********
-0.87: *************
-0.23: ***************
0.41 : ***********
1.04 : ********
1.68 : *
2.32 :
Parameters:
  • height - Height of the histogram in characters
  • character - Character to use