Histogram made easy for command line freak

July 4th, 2005


It’s quite a chore to make a histogram. It comes to me many time that I have to make a histogram for a list of numbers. I had to rewrite the program everytime. But, this time I’ll just write a good one and publish it so that other people(including me) won’t have to do this chore again. Without saying much here you go Histogram.tar.gz This program use Logarithmic way of printing program status.

After you download the file, gunzip and untar it. Then compile it using javac. Then you are good to go. To use this program, first you need a file that contains a list of number(any format that pass Java Double.ParseDouble(x) is ok), one number per line. If you don’t have one use this file allEvents.dat.tar.gz(gunzip and untar it first). Then type this to Terminal
java Histogram 50 < allEvents.dat > histogram.dat
This commaind will tell the program to use 50 bins for histogramming.Then histogram.dat will contain lines of the form
midValue count

You can import this file to your favourite plotting program like xmgrace or excel and make the plot.

Entry Filed under: Physics, current work, Programming, OSX Tip

Leave a Comment

You must be logged in to post a comment.

Trackback this post  |  Subscribe to the comments via RSS Feed


Calendar

July 2005
M T W T F S S
    Aug »
 123
45678910
11121314151617
18192021222324
25262728293031

Most Recent Posts