-
Notifications
You must be signed in to change notification settings - Fork 0
/
dorm_thresh_plots.R
144 lines (122 loc) · 5.53 KB
/
dorm_thresh_plots.R
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
### DORM ACTIVE CASE THRESHOLDS ####
xx<- ts_active_dorm %>%
filter(!is.na(dorm)) %>%
mutate(above5 = active_cases>=5) %>%
mutate(above10 = active_cases>=10) %>%
mutate(above3 = active_cases>=3) %>%
mutate(above3_below5 = active_cases %in% 3:4) %>%
filter(!is.na(active_cases))
ggplot(xx, aes(y=dorm, x=testdate, fill=active_cases)) +
geom_tile() +
scale_x_date(breaks="2 weeks") +
theme_bw() +
scale_fill_continuous_sequential(name="Active Cases") +
theme(axis.text.x = element_text(angle=30, vjust=1, hjust=1))
ggsave("figures/dorm_thresh.pdf", width=8, height=8)
ggplot(xx, aes(y=dorm, x=testdate, fill=above5)) +
geom_tile() +
scale_x_date(breaks="2 weeks") +
theme_bw() +
scale_fill_manual(name="Active Cases\n>=5", values=c("#e3e3e3", "#455e96")) +
theme(axis.text.x = element_text(angle=30, vjust=1, hjust=1))
ggsave("figures/dorm_thresh_5.pdf", width=8, height=8)
ggplot(xx, aes(y=dorm, x=testdate, fill=above10)) +
geom_tile() +
scale_x_date(breaks="2 weeks") +
theme_bw() +
scale_fill_manual(name="Active Cases\n>=10", values=c("#e3e3e3", "#455e96")) +
theme(axis.text.x = element_text(angle=30, vjust=1, hjust=1))
ggsave("figures/dorm_thresh_10.pdf", width=8, height=8)
ggplot(xx, aes(y=dorm, x=testdate, fill=above3)) +
geom_tile() +
scale_x_date(breaks="2 weeks") +
theme_bw() +
scale_fill_manual(name="Active Cases\n>=3", values=c("#e3e3e3", "#455e96")) +
theme(axis.text.x = element_text(angle=30, vjust=1, hjust=1))
ggsave("figures/dorm_thresh_3.pdf", width=8, height=8)
dates <- c("2020-08-24", "2020-08-31", "2020-09-07", "2020-09-14", "2020-10-31", "2020-11-07")
dates <- as.Date(dates)
ggplot(ts_quar_campus %>% filter(campus_fac == "UNH Durham"), aes(x=date, y=nbed)) +
geom_col(aes(fill=off_campus_fac))+
theme_bw()+
scale_fill_brewer("",palette="Dark2") +
scale_y_continuous(name = "", breaks=breaks_pretty()) +
scale_x_date(name="", breaks="1 week", limits = xaxis_entire) +
theme(legend.position = "bottom", legend.title = element_blank()) +
geom_hline(aes(yintercept=quar_bed_limit), lty=2, col="red") +
theme(axis.text.x = element_text(angle=45, vjust = 1, hjust=1)) +
geom_vline(xintercept = dates, linetype="dashed")
ggsave("figures/ts_quar_beds_labelled.pdf", width=8, height=6)
ggplot(ts_isol_campus %>% filter(campus_fac == "UNH Durham"), aes(x=date, y=nbed)) +
geom_col(aes(fill=off_campus_fac), width=0.9)+
theme_bw()+
scale_fill_brewer("",palette="Dark2") +
scale_y_continuous(name = "", breaks=breaks_pretty()) +
scale_x_date(name="", breaks="1 week", limits = xaxis_entire) +
theme(legend.position = "bottom", legend.title = element_blank()) +
geom_hline(aes(yintercept=isol_bed_limit), lty=2, col="red") +
theme(axis.text.x = element_text(angle=45, vjust = 1, hjust=1)) +
geom_vline(xintercept = dates, linetype="dashed")
ggsave("figures/ts_isol_beds_labelled.pdf", width=8, height=6)
### DORM QUARANTINE THRESHOLDS ####
xx_active <- ts_active_dorm %>%
filter(!is.na(dorm)) %>%
mutate(above5 = active_cases>=5) %>%
mutate(above10 = active_cases>=10) %>%
mutate(above3 = active_cases>=3) %>%
mutate(above3_below5 = active_cases %in% 3:4) %>%
filter(!is.na(active_cases))
# entries into quarantine
xx <- ts_quar_ent_dorm %>%
filter(!is.na(dorm)) %>%
mutate(above5 = n>=5) %>%
mutate(above10 = n>=10) %>%
mutate(above3 = n>=3) %>%
filter(!is.na(n))
ggplot() +
geom_tile(data=xx_active, aes(y=dorm, x=testdate, fill=active_cases)) +
scale_x_date(breaks="2 weeks") +
theme_bw() +
scale_fill_continuous_sequential(name="Active Cases") +
geom_point(data=xx, aes(y=dorm, x=date, col=above5)) +
scale_color_manual(name="Quar entries\n>=5", values=c(NA, "red")) +
theme(axis.text.x = element_text(angle=30, vjust=1, hjust=1)) +
labs(y="", x="")
ggsave("figures/dorm_quar_entry_thresh5.pdf", width=8, height=8)
ggplot() +
geom_tile(data=xx_active, aes(y=dorm, x=testdate, fill=active_cases)) +
scale_x_date(breaks="2 weeks") +
theme_bw() +
scale_fill_continuous_sequential(name="Active Cases") +
geom_point(data=xx, aes(y=dorm, x=date, col=above3)) +
scale_color_manual(name="Quar entries\n>=3", values=c(NA, "red")) +
theme(axis.text.x = element_text(angle=30, vjust=1, hjust=1)) +
labs(y="", x="")
ggsave("figures/dorm_quar_entry_thresh3.pdf", width=8, height=8)
# total in quarantine
xx <- ts_quar_dorm %>%
filter(!is.na(dorm)) %>%
mutate(above5 = n>=5) %>%
mutate(above10 = n>=10) %>%
mutate(above8 = n>=8) %>%
filter(!is.na(n))
ggplot() +
geom_tile(data=xx_active, aes(y=dorm, x=testdate, fill=active_cases)) +
scale_x_date(breaks="2 weeks") +
theme_bw() +
scale_fill_continuous_sequential(name="Active Cases") +
geom_point(data=xx, aes(y=dorm, x=date, col=above5)) +
scale_color_manual(name="In Quar\n>=5", values=c(NA, "red")) +
theme(axis.text.x = element_text(angle=30, vjust=1, hjust=1)) +
labs(y="", x="")
ggsave("figures/dorm_quar_thresh5.pdf", width=8, height=8)
ggplot() +
geom_tile(data=xx_active, aes(y=dorm, x=testdate, fill=active_cases)) +
scale_x_date(breaks="2 weeks") +
theme_bw() +
scale_fill_continuous_sequential(name="Active Cases") +
geom_point(data=xx, aes(y=dorm, x=date, col=above8)) +
scale_color_manual(name="In Quar\n>=8", values=c(NA, "red")) +
theme(axis.text.x = element_text(angle=30, vjust=1, hjust=1)) +
labs(y="", x="")
ggsave("figures/dorm_quar_thresh8.pdf", width=8, height=8)