修订版 | 9c4265eca0143c2485d7fa8cf0b2deaa0644d4ae (tree) |
---|---|
时间 | 2022-01-02 22:27:43 |
作者 | Lorenzo Isella <lorenzo.isella@gmai...> |
Commiter | Lorenzo Isella |
I revised the plots and the statistics.
@@ -19,6 +19,8 @@ | ||
19 | 19 | |
20 | 20 | weekly_aver <- rollify(mean, window = 7) |
21 | 21 | |
22 | +system("rm *csv") | |
23 | +system("rm *pdf") | |
22 | 24 | |
23 | 25 | system("wget https://raw.githubusercontent.com/pcm-dpc/COVID-19/master/dati-andamento-nazionale/dpc-covid19-ita-andamento-nazionale.csv") |
24 | 26 |
@@ -27,19 +29,21 @@ | ||
27 | 29 | |
28 | 30 | |
29 | 31 | df <- df_ini %>% |
30 | - clean_names() %>% | |
32 | + clean_data() %>% | |
31 | 33 | mutate(data=as_date(data)) %>% |
32 | 34 | mutate(deceduti_giornalieri=diff_col2(deceduti)) %>% |
33 | - mutate(deceduti_settimanali=weekly_aver(deceduti_giornalieri)) %>% | |
34 | 35 | mutate(anno=year(data)) %>% |
35 | 36 | mutate(anno=as.factor(anno)) %>% |
36 | 37 | mutate(giorno=yday(data)) %>% |
37 | 38 | mutate(data_no_anno=as_date(giorno)-1) %>% |
39 | + mutate(positivi_progressione=cumsum(nuovi_positivi)) %>% | |
40 | + ## group_by(anno) %>% | |
41 | + mutate(deceduti_settimanali=weekly_aver(deceduti_giornalieri)) %>% | |
38 | 42 | mutate(ingressi_settimanali_terapia_intensiva=weekly_aver(ingressi_terapia_intensiva)) %>% |
39 | 43 | mutate(terapia_intensiva_settimanale=weekly_aver(terapia_intensiva)) %>% |
40 | 44 | mutate(ricoverati_settimanale=weekly_aver(ricoverati_con_sintomi)) %>% |
41 | - mutate(ospedalizzati_settimanale=weekly_aver(totale_ospedalizzati)) | |
42 | - | |
45 | + mutate(ospedalizzati_settimanale=weekly_aver(totale_ospedalizzati)) ## %>% | |
46 | + ## ungroup | |
43 | 47 | |
44 | 48 | |
45 | 49 | gpl <- ggplot(df, aes(x=data, y=deceduti_settimanali )) + |
@@ -68,7 +72,7 @@ | ||
68 | 72 | guide = guide_axis(n.dodge = 2) , |
69 | 73 | expand=c(0.03,0.03)) + |
70 | 74 | scale_color_scico_d(NULL, palette="hawaii" , |
71 | - labels=c("2020", "2021") | |
75 | + labels=c("2020", "2021", "2022") | |
72 | 76 | )+ |
73 | 77 | |
74 | 78 | labs(title=NULL)+ |
@@ -81,13 +85,15 @@ | ||
81 | 85 | |
82 | 86 | |
83 | 87 | gpl2bis <- ggplot(df, aes(x=data_no_anno, y=deceduti_giornalieri, color=anno )) + |
84 | - geom_line(size=1., alpha=1)+ | |
88 | + geom_line(size=.7, alpha=1)+ | |
89 | + geom_point(size=1., alpha=1)+ | |
90 | + | |
85 | 91 | my_ggplot_theme2("top")+ |
86 | 92 | scale_x_date(breaks="1 months", date_labels = "%b", |
87 | 93 | guide = guide_axis(n.dodge = 2) , |
88 | 94 | expand=c(0.03,0.03)) + |
89 | 95 | scale_color_scico_d(NULL, palette="hawaii" , |
90 | - labels=c("2020", "2021") | |
96 | + labels=c("2020", "2021", "2022") | |
91 | 97 | )+ |
92 | 98 | |
93 | 99 | labs(title=NULL)+ |
@@ -100,53 +106,62 @@ | ||
100 | 106 | |
101 | 107 | |
102 | 108 | |
103 | -gpl3 <- ggplot(df, aes(x=data_no_anno, y=ingressi_settimanali_terapia_intensiva, color=anno )) + | |
104 | - geom_line(size=1., alpha=1)+ | |
109 | +gpl3 <- ggplot(df, aes(x=data_no_anno, y=ingressi_terapia_intensiva, | |
110 | + color=anno )) + | |
111 | + geom_line(size=.7, alpha=1)+ | |
112 | + geom_point(size=1, alpha=1)+ | |
113 | + | |
105 | 114 | my_ggplot_theme2("top")+ |
106 | 115 | scale_x_date(breaks="1 months", date_labels = "%b", |
107 | 116 | guide = guide_axis(n.dodge = 2) , |
108 | 117 | expand=c(0.03,0.03)) + |
109 | 118 | scale_color_scico_d(NULL, palette="hawaii" , |
110 | - labels=c("2020", "2021") | |
119 | + labels=c("2020", "2021", "2022") | |
111 | 120 | )+ |
112 | 121 | |
113 | 122 | labs(title=NULL)+ |
114 | 123 | xlab(NULL)+ |
115 | - ylab("Media Mobile Settimanale\nIngressi Terapia Intensiva") | |
124 | + ylab("Ingressi Terapia Intensiva") | |
116 | 125 | |
117 | 126 | |
118 | -ggsave("ingressi_terapia_intensiva_ma_settimanali.pdf",gpl3, width=7*golden_ratio,height=7 , device = cairo_pdf ) | |
127 | +ggsave("ingressi_terapia_intensiva.pdf",gpl3, width=7*golden_ratio,height=7 , device = cairo_pdf ) | |
119 | 128 | |
120 | 129 | |
121 | 130 | |
122 | -gpl4 <- ggplot(df, aes(x=data_no_anno, y=terapia_intensiva_settimanale, color=anno )) + | |
123 | - geom_line(size=1., alpha=1)+ | |
131 | +gpl4 <- ggplot(df, aes(x=data_no_anno, y=terapia_intensiva, color=anno )) + | |
132 | + geom_line(size=.7, alpha=1)+ | |
133 | + geom_point(## aes(x=data_no_anno,y=terapia_intensiva, | |
134 | + ## color=anno ), | |
135 | + size=1, alpha=1)+ | |
136 | + | |
124 | 137 | my_ggplot_theme2("top")+ |
125 | 138 | scale_x_date(breaks="1 months", date_labels = "%b", |
126 | 139 | guide = guide_axis(n.dodge = 2) , |
127 | 140 | expand=c(0.03,0.03)) + |
128 | 141 | scale_color_scico_d(NULL, palette="hawaii" , |
129 | - labels=c("2020", "2021") | |
142 | + labels=c("2020", "2021", "2022") | |
130 | 143 | )+ |
131 | 144 | |
132 | 145 | labs(title=NULL)+ |
133 | 146 | xlab(NULL)+ |
134 | - ylab("Media Mobile Settimanale\nPazienti in Terapia Intensiva") | |
147 | + ylab("Pazienti in Terapia Intensiva") | |
135 | 148 | |
136 | 149 | |
137 | -ggsave("occupazione_terapia_intensiva_ma_settimanali.pdf",gpl4, width=7*golden_ratio,height=7 , device = cairo_pdf ) | |
150 | +ggsave("occupazione_terapia_intensiva_settimanali.pdf",gpl4, width=7*golden_ratio,height=7 , device = cairo_pdf ) | |
138 | 151 | |
139 | 152 | |
140 | 153 | |
141 | 154 | |
142 | 155 | gpl5 <- ggplot(df, aes(x=data_no_anno, y=isolamento_domiciliare, color=anno )) + |
143 | - geom_line(size=1., alpha=1)+ | |
156 | + geom_point(size=1., alpha=1)+ | |
157 | + | |
158 | + geom_line(size=.7, alpha=1)+ | |
144 | 159 | my_ggplot_theme2("top")+ |
145 | 160 | scale_x_date(breaks="1 months", date_labels = "%b", |
146 | 161 | guide = guide_axis(n.dodge = 2) , |
147 | 162 | expand=c(0.03,0.03)) + |
148 | 163 | scale_color_scico_d(NULL, palette="hawaii" , |
149 | - labels=c("2020", "2021") | |
164 | + labels=c("2020", "2021", "2022") | |
150 | 165 | )+ |
151 | 166 | |
152 | 167 | labs(title=NULL)+ |
@@ -158,55 +173,112 @@ | ||
158 | 173 | |
159 | 174 | |
160 | 175 | |
161 | -gpl6 <- ggplot(df, aes(x=data_no_anno, y=ricoverati_settimanale, color=anno )) + | |
162 | - geom_line(size=1., alpha=1)+ | |
176 | +## gpl6 <- ggplot(df, aes(x=data_no_anno, y=ricoverati_settimanale, color=anno )) + | |
177 | +## geom_line(size=1., alpha=1)+ | |
178 | +## my_ggplot_theme2("top")+ | |
179 | +## scale_x_date(breaks="1 months", date_labels = "%b", | |
180 | +## guide = guide_axis(n.dodge = 2) , | |
181 | +## expand=c(0.03,0.03)) + | |
182 | +## scale_color_scico_d(NULL, palette="hawaii" , | |
183 | +## labels=c("2020", "2021", "2022") | |
184 | +## )+ | |
185 | + | |
186 | +## labs(title=NULL)+ | |
187 | +## xlab(NULL)+ | |
188 | +## ylab("Ricoverati") | |
189 | + | |
190 | + | |
191 | +## ggsave("ricoverati.pdf",gpl6, width=7*golden_ratio,height=7 , device = cairo_pdf ) | |
192 | + | |
193 | + | |
194 | + | |
195 | + | |
196 | +gpl7 <- ggplot(df, aes(x=data_no_anno, y=totale_ospedalizzati, color=anno )) + | |
197 | + geom_line(size=.7, alpha=1)+ | |
198 | + geom_point(size=1, alpha=1)+ | |
199 | + | |
163 | 200 | my_ggplot_theme2("top")+ |
164 | 201 | scale_x_date(breaks="1 months", date_labels = "%b", |
165 | 202 | guide = guide_axis(n.dodge = 2) , |
166 | 203 | expand=c(0.03,0.03)) + |
167 | 204 | scale_color_scico_d(NULL, palette="hawaii" , |
168 | - labels=c("2020", "2021") | |
205 | + labels=c("2020", "2021", "2022") | |
169 | 206 | )+ |
170 | 207 | |
171 | 208 | labs(title=NULL)+ |
172 | 209 | xlab(NULL)+ |
173 | - ylab("Ricoverati Media Mobile Settimanale") | |
210 | + ylab("Totale Ospedalizzati") | |
174 | 211 | |
175 | 212 | |
176 | -ggsave("ricoverati_media_mobile.pdf",gpl6, width=7*golden_ratio,height=7 , device = cairo_pdf ) | |
213 | +ggsave("ospedalizzati.pdf",gpl7, width=7*golden_ratio,height=7 , device = cairo_pdf ) | |
177 | 214 | |
178 | 215 | |
179 | 216 | |
180 | 217 | |
181 | -gpl7 <- ggplot(df, aes(x=data_no_anno, y=ospedalizzati_settimanale, color=anno )) + | |
182 | - geom_line(size=1., alpha=1)+ | |
218 | + | |
219 | + | |
220 | +gpl8 <- ggplot(df, aes(x=data_no_anno, y=totale_positivi, color=anno )) + | |
221 | + geom_line(size=.7, alpha=1)+ | |
222 | + geom_point(size=1., alpha=1)+ | |
223 | + | |
183 | 224 | my_ggplot_theme2("top")+ |
184 | 225 | scale_x_date(breaks="1 months", date_labels = "%b", |
185 | 226 | guide = guide_axis(n.dodge = 2) , |
186 | 227 | expand=c(0.03,0.03)) + |
187 | 228 | scale_color_scico_d(NULL, palette="hawaii" , |
188 | - labels=c("2020", "2021") | |
229 | + labels=c("2020", "2021", "2022") | |
189 | 230 | )+ |
190 | 231 | |
191 | 232 | labs(title=NULL)+ |
192 | 233 | xlab(NULL)+ |
193 | - ylab("Totale Ospedalizzati Media Mobile Settimanale") | |
234 | + ylab("Totale Positivi") | |
194 | 235 | |
195 | 236 | |
196 | -ggsave("ospedalizzati_media_mobile.pdf",gpl7, width=7*golden_ratio,height=7 , device = cairo_pdf ) | |
197 | - | |
198 | - | |
199 | -system("wget https://raw.githubusercontent.com/pcm-dpc/COVID-19/master/dati-regioni/dpc-covid19-ita-regioni.csv") | |
200 | - | |
201 | - | |
202 | -df_regio_ini <- read_csv("dpc-covid19-ita-regioni.csv") | |
237 | +ggsave("totale_positivi.pdf",gpl8, width=7*golden_ratio,height=7 , device = cairo_pdf ) | |
203 | 238 | |
204 | 239 | |
205 | 240 | |
206 | -system("wget https://raw.githubusercontent.com/pcm-dpc/COVID-19/master/dati-province/dpc-covid19-ita-province.csv") | |
241 | + | |
242 | +gpl9 <- ggplot(df, aes(x=data, y=positivi_progressione## , color=anno | |
243 | + )) + | |
244 | + geom_line(size=.7, alpha=1)+ | |
245 | + geom_point(size=1., alpha=1)+ | |
246 | + | |
247 | + my_ggplot_theme2("top")+ | |
248 | + scale_x_date(breaks="1 months", date_labels = "%b\n%y", | |
249 | + guide = guide_axis(n.dodge = 2) , | |
250 | + expand=c(0.03,0.03)) + | |
251 | + ## scale_color_scico_d(NULL, palette="hawaii" , | |
252 | + ## labels=c("2020", "2021", "2022") | |
253 | + ## )+ | |
254 | + | |
255 | + labs(title=NULL)+ | |
256 | + xlab(NULL)+ | |
257 | + ylab("Incidenza cumulativa") | |
207 | 258 | |
208 | 259 | |
209 | -df_pro_ini <- read_csv("dpc-covid19-ita-province.csv") | |
260 | +ggsave("incidenza.pdf",gpl9, width=7*golden_ratio,height=7 , device = cairo_pdf ) | |
261 | + | |
262 | + | |
263 | + | |
264 | + | |
265 | + | |
266 | + | |
267 | + | |
268 | + | |
269 | + | |
270 | + | |
271 | +## system("wget https://raw.githubusercontent.com/pcm-dpc/COVID-19/master/dati-regioni/dpc-covid19-ita-regioni.csv") | |
272 | + | |
273 | + | |
274 | +## df_regio_ini <- read_csv("dpc-covid19-ita-regioni.csv") | |
275 | + | |
276 | + | |
277 | + | |
278 | +## system("wget https://raw.githubusercontent.com/pcm-dpc/COVID-19/master/dati-province/dpc-covid19-ita-province.csv") | |
279 | + | |
280 | + | |
281 | +## df_pro_ini <- read_csv("dpc-covid19-ita-province.csv") | |
210 | 282 | |
211 | 283 | |
212 | 284 | print("So far so good") |