-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_vs_confirmed.py
89 lines (79 loc) · 5.26 KB
/
test_vs_confirmed.py
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
86
87
88
89
# [date,lab_test,confirmed_case,case_rate, _]
# date = "April-03" ==> 04-03
from datetime import datetime
from matplotlib import pyplot as plt
# save_graph_folder = "C:\\Users\\KME Hasan\\Documents\\sim_graph\\auto_save\\"
# from linear_regression_on_sird import estimate_coef
data = [['04-03', 203, 5, 2, 2], ['04-04', 434, 9, 2, 2], ['04-05', 367, 18, 5, 5],
['04-06', 468, 35, 7, 7], ['04-07', 679, 41, 6, 6], ['04-08', 981, 54, 6, 6],
['04-09', 905, 112, 12, 12], ['04-10', 1184, 94, 8, 8], ['04-11', 954, 58, 6, 6],
['04-12', 1340, 139, 10, 10], ['04-13', 1570, 182, 12, 12], ['04-14', 1905, 209, 11, 11],
['04-15', 1740, 219, 13, 13], ['04-16', 2019, 341, 17, 17], ['04-17', 2190, 266, 12, 12],
['04-18', 2114, 306, 14, 14], ['04-19', 2634, 312, 12, 12], ['04-20', 2779, 492, 18, 18],
['04-21', 2974, 434, 15, 15], ['04-22', 3096, 390, 13, 13], ['04-23', 3416, 414, 12, 12],
['04-24', 3686, 503, 14, 14], ['04-25', 3337, 309, 9, 9], ['04-26', 3476, 418, 12, 12],
['04-27', 3812, 497, 13, 13], ['04-28', 4332, 549, 13, 13], ['04-29', 4968, 641, 13, 13],
['04-30', 4965, 564, 11, 11], ['05-01', 5573, 571, 10, 10], ['05-02', 5827, 552, 9, 9],
['05-03', 5368, 665, 12, 12], ['05-04', 6260, 688, 11, 11], ['05-05', 5711, 786, 14, 14],
['05-06', 6241, 790, 13, 13], ['05-07', 5867, 706, 12, 12], ['05-08', 5941, 709, 12, 12],
['05-09', 5465, 636, 12, 12], ['05-10', 5638, 887, 16, 16], ['05-11', 7208, 1034, 14, 14],
['05-12', 6773, 969, 14, 14], ['05-13', 7900, 1162, 15, 15], ['05-14', 7392, 1041, 14, 14],
['05-15', 8582, 1202, 14, 14], ['05-16', 6782, 930, 14, 14], ['05-17', 8184, 1273, 16, 16],
['05-18', 9788, 1602, 16, 16], ['05-19', 8449, 1251, 15, 15], ['05-20', 10207, 1617, 16, 16],
['05-21', 10262, 1773, 17, 17], ['05-22', 9727, 1694, 17, 17], ['05-23', 10834, 1873, 17, 17],
['05-24', 8908, 1532, 17, 17], ['05-25', 9451, 1975, 21, 21], ['05-26', 5407, 1166, 22, 22],
['05-27', 8015, 1541, 19, 19], ['05-28', 9310, 2029, 22, 22], ['05-29', 11301, 2523, 22, 22],
['05-30', 9987, 1764, 18, 18], ['05-31', 11876, 2545, 21, 21], ['06-01', 11439, 2381, 21, 21],
['06-02', 12704, 2911, 23, 23], ['06-03', 12510, 2695, 22, 22], ['06-04', 12694, 2423, 19, 19],
['06-05', 14088, 2828, 20, 20], ['06-06', 12486, 2635, 21, 21], ['06-07', 13136, 2743, 21, 21],
['06-08', 12944, 2735, 21, 21], ['06-09', 14668, 3171, 22, 22], ['06-10', 15965, 3190, 20, 20],
['06-11', 15772, 3187, 20, 20], ['06-12', 15990, 3471, 22, 22], ['06-13', 16638, 2856, 17, 17],
['06-14', 14505, 3141, 22, 22], ['06-15', 15038, 3099, 21, 21], ['06-16', 17214, 3862, 22, 22],
['06-17', 17527, 4008, 23, 23], ['06-18', 16259, 3803, 23, 23], ['06-19', 15045, 3243, 22, 22],
['06-20', 14031, 3240, 23, 23], ['06-21', 15585, 3531, 23, 23], ['06-22', 15555, 3480, 22, 22],
['06-23', 16292, 3412, 21, 21], ['06-24', 16433, 3462, 21, 21], ['06-25', 17999, 3946, 22, 22],
['06-26', 18498, 3868, 21, 21], ['06-27', 15157, 3504, 23, 23], ['06-28', 18099, 3809, 21, 21],
['06-29', 17837, 4014, 23, 23], ['06-30', 18426, 3682, 20, 20], ['07-01', 17875, 3775, 21, 21],
['07-02', 18362, 4019, 22, 22], ['07-03', 14650, 3114, 21, 21], ['07-04', 14727, 3288, 22, 22],
['07-05', 13988, 2738, 20, 20], ['07-06', 14245, 3201, 22, 22], ['07-07', 13173, 3027, 23, 23],
['07-08', 15672, 3489, 22, 22], ['07-09', 15632, 3360, 21, 21], ['07-10', 13488, 2949, 22, 22],
['07-11', 11193, 2686, 24, 24], ['07-12', 11059, 2666, 24, 24], ['07-13', 12423, 3099, 25, 25],
['07-14', 13453, 3163, 24, 24], ['07-15', 14002, 3533, 25, 25], ['07-16', 12889, 2733, 21, 21],
['07-17', 13460, 3034, 23, 23], ['07-18', 10923, 2709, 25, 25], ['07-19', 10625, 2459, 23, 23],
['07-20', 13362, 2928, 22, 22], ['07-21', 12898, 2928, 24, 24], ['07-22', 12050, 2744, 23, 23],
['07-23', 12398, 2856, 23, 23]]
# datetime.strptime(d2, "%Y-%m-%d")
dates = []
confirmed_cases = []
lab_tests = []
case_rates = []
for i in data:
date, lab_test, confirmed_case, case_rate, _ = i
dates.append(datetime.strptime("2020-" + date, "%Y-%m-%d"))
confirmed_cases.append(confirmed_case/1000)
lab_tests.append(lab_test/1000)
case_rates.append(case_rate)
import seaborn as sns;sns.set()
import numpy as np
from scipy.stats import linregress
fig, ax1 = plt.subplots()
color = 'tab:blue'
ax1.plot(dates,confirmed_cases,color=color)
l1, = ax1.plot(dates,confirmed_cases, '.', color=color, label='Confirmed Case')
ax1.plot(dates,lab_tests,color=color)
l2, = ax1.plot(dates,lab_tests, '^', color=color, label='Lab Test')
ax1.set_ylabel("Count (in 1,000)",color=color)
ax1.tick_params(axis='y',labelcolor=color)
ax1.set_ylim(bottom=0, top=27)
ax1.tick_params(axis='x', labelrotation=45)
# ax1.legend(loc=2)
ax2 = ax1.twinx()
color = 'tab:red'
ax2.set_ylabel("Positive Test Rate (in %)",color=color)
ax2.plot(dates,case_rates,color=color)
l3, = ax2.plot(dates,case_rates, '.', color=color, label='Test Positivity Rate')
ax2.tick_params(axis='y',labelcolor=color)
ax2.set_ylim(bottom=0, top=27)
ax2.legend(handles=[l1, l2, l3], loc=2)
fig.tight_layout()
plt.show()