-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
plot_PA_Cases.gpi
85 lines (84 loc) · 2.35 KB
/
plot_PA_Cases.gpi
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Graph 1
reset
#set xlabel "Date"
set xdata time
set timefmt "%Y-%m-%d"
set ylabel "Number of Confirmed Cases"
set autoscale
set grid
samples(x) = $0 > 4 ? 5 : ($0+1)
avg5(x) = (shift5(x), (back1+back2+back3+back4+back5)/samples($0))
shift5(x) = (back5 = back4, back4 = back3, back3 = back2, back2 = back1, back1 = x)
init(x) = (back1 = back2 = back3 = back4 = back5 = sum = 0)
set terminal png size 900,1200
set output 'cases.png'
# Attempt exponential fit
#a = 0.4737
#b = 0.3942
#c = 1.5
#a = 3.91e-61
#b = 911
#c = -3.3
#f(x) = a*exp(((b*x)/1e10)+c)
#fit f(x) "cases.data" using 1:2 via a, b, c
set multiplot layout 3, 1 title "PA COVID-19 Cases"
set title "Standard Scale"
unset key
plot "cases.data" every ::7 using 1:2 with linespoints linestyle 1 title "Cases"#, f(x)
#
set logscale y
unset key
set title "Log Scale"
plot "cases.data" every ::7 using 1:2 with linespoints linestyle 1 title "Cases"#, f(x)
unset logscale y
#
set title "Confirmed Pennsylvania COVID-19 Deaths"
#set xlabel "Date"
set ylabel "Deaths"
set xdata time
plot "cases.data" every ::7 using 1:3 smooth unique with linespoints linestyle 1 title "Deaths"
unset xdata
unset multiplot
# Graph 2
set terminal png size 900,900
set output "trajectory.png"
set multiplot layout 2,1
#
set title "Growth Ratio of COVID-19 Confirmed Cases"
set ylabel "R_0"
unset xlabel #"Date"
set xdata time
#set yrange [0.5:2]
set autoscale
set key
plot sum = init(0), \
"cases.data" every ::45 using 1:5 smooth unique with linespoints linestyle 1 title "R_0 Growth Ratio",\
"cases.data" every ::45 using 1:(avg5($5)) title "5 Day Rolling Average" with linespoints pt 7 ps 0.5 lw 1 lc rgb "blue"
unset xdata
unset yrange
#
set title "Trajectory of COVID-19 Confirmed Cases"
set ylabel "New Cases"
set xlabel "Total Confirmed Cases"
unset key
set logscale x
set logscale y
set xrange [2.00000:2e+07]
plot sum = init(0), \
"cases.data" using 2:(avg5($4)) with lines lw 3 lc rgb "blue" title "Averaged Trajectory"
unset xrange
unset logscale x
unset logscale y
#
unset multiplot
# Graph 3
set terminal png size 900,900
set key left top
set output "new_cases.png"
set title "Daily New Cases"
set ylabel "Number of New Cases"
unset xlabel
set xdata time
plot sum = init(0),\
"cases.data" every ::7 using 1:4 with linespoints linestyle 1 title "New Cases",\
"cases.data" every ::7 using 1:(avg5($4)) with lines lw 3 lc rgb "blue" title "5 Day Rolling Average"