How make quick histogram using gnuplot [data elaboration]

Make an histogram using gnuplot isn't very simple if you have raw data (not collected in classes).
Here we show a quick and easy way to create and draw an histogram using gnuplot starting from raw data.

This is the command you have to use:

bw = 2   #substitute what you want
bin(x,width)=width*floor(x/width)
plot 'data.dat' using (bin($2,bw)):(1.0) smooth freq with boxes

And this is the output:



file "data.dat" exemple:
1 1
2 3
4 12
5 6
.....

[Via: http://www.nabble.com/gnuplot-histograms-td15811193.html]