data series as text -> histogram
Python
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
README.md
text2histo.py

README.md

README

Takes lines of integers (or characters whose length is notable) and displays a histogram of the occurence frequencies of the integer (or of the length of the lines' characters).

Examples

$ text2histo.py 1 1 2 3 3 3 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5  5 6 6 6 7 8 8 9 12
   12 ..  10.8 | [ 1] #
 10.8 ..   9.6 | [ 0]
  9.6 ..   8.4 | [ 1] #
  8.4 ..   7.2 | [ 2] ##
  7.2 ..   6.0 | [ 1] #
  6.0 ..   4.8 | [21] #####################
  4.8 ..   3.6 | [ 2] ##
  3.6 ..   2.4 | [ 3] ###
  2.4 ..   1.2 | [ 1] #
  1.2 ..     1 | [ 2] ##

$ text2histo.py --bins=5 1 1 2 3 3 3 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5  5 6 6 6 7 8 8 9 12
  12 ..  9.6 | [ 1] #
 9.6 ..  7.2 | [ 3] ###
 7.2 ..  4.8 | [22] ######################
 4.8 ..  2.4 | [ 5] #####
 2.4 ..    1 | [ 3] ###


$ text2histo.py  < ~/src/stopwords.txt
   11 ..  10.0 | [ 2] #
 10.0 ..   9.0 | [ 5] ##
  9.0 ..   8.0 | [12] ######
  8.0 ..   7.0 | [18] #########
  7.0 ..   6.0 | [47] #######################
  6.0 ..   5.0 | [58] #############################
  5.0 ..   4.0 | [86] ###########################################
  4.0 ..   3.0 | [98] ##################################################
  3.0 ..   2.0 | [53] ###########################
  2.0 ..   1.0 | [24] ############
  1.0 ..     1 | [26] #############


$ text2histo.py -w20  < ~/src/stopwords.txt
   11 ..  10.0 | [ 2]
 10.0 ..   9.0 | [ 5] #
  9.0 ..   8.0 | [12] ##
  8.0 ..   7.0 | [18] ###
  7.0 ..   6.0 | [47] #########
  6.0 ..   5.0 | [58] ###########
  5.0 ..   4.0 | [86] #################
  4.0 ..   3.0 | [98] ####################
  3.0 ..   2.0 | [53] ##########
  2.0 ..   1.0 | [24] ####
  1.0 ..     1 | [26] #####

$ text2histo.py -w20 --raw < ~/src/stopwords.txt
11,10.0,2
10.0,9.0,5
9.0,8.0,12
8.0,7.0,18
7.0,6.0,47
6.0,5.0,58
5.0,4.0,86
4.0,3.0,98
3.0,2.0,53
2.0,1.0,24
1.0,1,26

$ text2histo.py -w20 --raw < ~/src/stopwords.txt | cut -d, -f 1,3 | ~/bin/scatter.py --bars
 19|
   |
 17|
   |
 15|
   |
 13|
   |
 11|
   |
  9|
   |
  7|
   |
  5|
   |
  3|
   |
  1| 1111111111
   | ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
  0|1⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
   +----------------------------------------
        0         9        19        29        39