On 11 Jul 2011, at 16:42, Robbie Morrison wrote:
> Say I have a single column of sorted numbers (given
> here horizontally):
>
> 3 3 4 4 4 5 6 6 8
>
> and want to plot a histogram, something like:
>
> |
> |
> | =
> | = = =
> | = = = = =
> +---+---+---+---+---+---+---+---+---
> 0 1 2 3 4 5 6 7 8
>
> In order to get the data into a suitable state for
> plotting with 'histogram', do I have to fill the bins
> myself, or can 'gnuplot' do that for me?
You could try this to start with. It assumes you have your raw data in a single-column file called foo.dat.
set boxwidth 1
bw = 1
bin(x,width)=width*floor(x/width) + bw/2.0
set xrange [0:*]
set yrange [0:*]
plot 'foo.dat' using (bin($1,bw)):(1.0) smooth freq with boxes
Best wishes,
Gareth
|