dwww Home | Show directory contents | Find package

#
# Demo illustrating the relationship between
# a binned histogram and a kernel density model of the same data.
#
$DATA << EOD
1       1
2       1
8       1
9       1
17      1
17      1
9       1
9       1
5       1
7       1
7       1
8       1
8       1
8       1
10      1
11      1
11      1
12      1
14      1
3       1
3       1
3       1
8       7
15      1
17      1
17      1
18      1
19      1
20      1
EOD

set title "Comparison of a binned histogram and\na kernel density model of the same data"

set style data lines
set xtics 1 norangelimit nomirror
set grid y
set yrange [0:5.5]
set style fill solid 0.5 noborder
set jitter spread 0.5

plot $DATA using 1 bins=20 with boxes title '20 bins', \
        '' using 1:(1) smooth kdensity bandwidth .5 lw 2 title 'smooth kdensity', \
        '' using 1:(.9) with impulse lc "black" title 'jittered data'
 
pause -1 "Hit return to continue"
reset

Generated by dwww version 1.15 on Fri May 24 02:25:30 CEST 2024.