command-png.gp (654B)
1 reset 2 n=100 #number of intervals 3 max=3. #max value 4 min=-3. #min value 5 width=(max-min)/n #interval width 6 #function used to map a value to the intervals 7 hist(x,width)=width*floor(x/width)+width/2.0 8 set term png #output terminal and file 9 set output "histogram.png" 10 set xrange [min:max] 11 set yrange [0:] 12 #to put an empty boundary around the 13 #data inside an autoscaled graph. 14 set offset graph 0.05,0.05,0.05,0.0 15 set xtics min,(max-min)/5,max 16 set boxwidth width*0.9 17 set style fill solid 0.5 #fillstyle 18 set tics out nomirror 19 set xlabel "x" 20 set ylabel "Frequency" 21 #count and plot 22 plot "data.dat" u (hist($1,width)):(1.0) smooth freq w boxes lc rgb"green" notitle