Mittwoch, 22. Oktober 2014

histogram with gnuplot

if you want to plot a histogram with gnuplot, just use the raw data in "data.dat" and plot the data via the following command:

the data is transformed into a histogram via the bin function and then plotted via the plot with boxes command.

  #!/usr/bin/gnuplot

file="data.dat"
binwidth=1.0
bin(x,width)=width*floor(x/width)
set style fill solid 0.5

plot file u (bin($1,binwidth)):(1.0) smooth freq with boxes ls 1 t 'total'


the result looks something like that:

Keine Kommentare:

Kommentar veröffentlichen