plot - how histogram in Gnuplot works -
i try reproduce simple histogram gnuplot simple macro:
reset n=9 #number of intervals width=1 #interval width hist(x,width)=width*floor(x/width) set terminal pngcairo size 800,500 enhanced font 'verdana,14' set output "test.png" set boxwidth width set style fill transparent solid 0.5 border #fillstyle set xrange [*:*] set yrange [0:2.] set xlabel "x" set ylabel "freq." plot "const.dat" u (hist($1,width)) smooth freq w boxes lc rgb "orange" notitle whit follow data:
1.1 1.1 1.1 1.1 1.1 1.1 1.1 1.1 now understand how hist(x,width) works in sense:
hist(x,width)=width*floor(x/width) works every numbers taking width=1 , then:
hist(1.1,1)=1*floor(1.1/1)=1
and on, right?
now (hist($1,width)) take elements in columns , applay hist function everyone.
and can able make follow plot macro above:!
question: if use (hist($1,width)):(1.0) don't understand whit plots change elements stay in 1 single boxes (from 0.5 1.5) ? 
in first case specify single column in using statement. since need @ least 2 (x , y-value), specified value (your hist(...)) used y-value , row number x-value. statement smooth frequency works such, takes points same x-value , sums corresponding y-values. in first example have no equal x-values since row number used.
in second example, use hist(...) value x-value, 1 rows. y-value 1.0. single box @ x=1 , y=8 (the number of rows).
Comments
Post a Comment