File: smooth.dem

package info (click to toggle)
gnuplot 6.0.2%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 14,940 kB
  • sloc: ansic: 95,319; cpp: 7,590; makefile: 2,470; javascript: 2,328; sh: 1,531; lisp: 664; perl: 304; pascal: 191; tcl: 88; python: 46
file content (62 lines) | stat: -rw-r--r-- 1,649 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#
# Find number of points
#
stats 'random-points' nooutput
N = STATS_records

bin(x, s) = s*int(x/s)

set zeroaxis
set style data points
set key box top left

# Uniform
set title "Uniform Distribution"
set boxwidth 0.05
set xrange [-0.1 : 1.1] noextend
set yrange [-0.4 : 1.6]
plot "random-points" u 1:(0.25*rand(0)-.35) t '', \
     "" u (bin($1,0.05)):(20./N) smooth freq t 'smooth frequency' w boxes, \
     "" u 1:(1.) smooth cnorm t 'smooth cnorm'
pause -1 "Hit enter to continue"


# Normal
set title "Normal Distribution"
set boxwidth 0.05
set xrange [* : *] noextend
set yrange [-0.4 : 1.1]
set ytics 0,.2

plot "random-points" u 2:(0.25*rand(0)-.35) t '', \
     "" u (bin($2,0.05)):(20./N) smooth freq t 'smooth frequency' w boxes, \
     "" u 2:(1.) smooth cnorm t 'smooth cnorm'
pause -1 "Hit enter to continue"


# Lognormal
set title "Lognormal Distribution"
set boxwidth 0.1
set xrange [0 : *] noextend
plot "random-points" u 3:(0.25*rand(0)-.35) t '', \
    "" u (bin($3,0.1)):(10./N) smooth freq t 'smooth frequency' w boxes, \
    "" u 3:(1.) smooth cnorm t 'smooth cnorm'
pause -1 "Hit enter to continue"


# Mixed
set title "Mixed Distribution (Lognormal with shifted Gaussian)"
set boxwidth 0.1
set xrange [* : *] noextend
set link y2 via y*N inverse y/N
set ytics nomirror  0,.2
set y2tics nomirror tc "red" 0,50

plot "random-points" u 4:(0.25*rand(0)-.35) t '', \
     "" u (bin($4,0.1)):(10./N) smooth freq t 'smooth frequency' w boxes, \
     "" u 4:(1.) smooth cnorm t 'smooth cnorm' lc "#88eeff" lw 5, \
     "" u 4:(1.) axes x1y2 smooth cumulative t 'smooth cumulative' lc "red"
pause -1 "Hit enter to continue"


reset