Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
numeroteca
covid19
Commits
b0b62aa9
Commit
b0b62aa9
authored
Mar 27, 2020
by
Carlos Cámara
Browse files
Adds intensive care sm for Italy.
parent
b772daad
Changes
1
Hide whitespace changes
Inline
Side-by-side
analysis/evolution_italia.R
View file @
b0b62aa9
...
...
@@ -50,12 +50,57 @@ data_i_cases$recovered_per_100000 <- round( data_i_cases$recovered / data_i_case
# Cambia el pie del gráfico pero conserva la fuente de los datos
caption_i
<-
"Gráfico: @numeroteca (montera34.com). Datos: Protezione Civile (Italia)"
periodo_i
<-
"2020.02.24 - 03.23"
plot_dpi
=
72
plot_width
=
490
plot_height
=
350
plot_units
=
"mm"
plot_sm_log
<-
function
(
df
,
col_date
=
date
,
col_category
,
col_group
,
labs_title
,
labs_subtitle
,
labs_caption
,
labs_x
,
labs_y
,
filename
){
col_date
<-
enquo
(
col_date
)
col_category
<-
enquo
(
col_category
)
col_group
<-
enquo
(
col_group
)
p
<-
ggplot
(
df
,
aes_q
(
col_date
,
col_category
,
group
=
col_group
))
+
# geom_line(aes(col_date, col_category, group = col_group),
# color = "#CACACA") +
geom_line
()
+
geom_point
(
size
=
0.5
)
+
scale_y_log10
(
minor_breaks
=
c
(
seq
(
0.1
,
1
,
0.1
),
seq
(
1
,
10
,
1
),
seq
(
10
,
100
,
10
),
seq
(
100
,
1000
,
100
)
)
)
+
facet_wrap
(
as_label
(
col_group
))
+
scale_x_date
(
date_breaks
=
"2 day"
,
date_labels
=
"%d"
,
expand
=
c
(
0
,
0
))
+
theme_minimal
(
base_family
=
"Roboto Condensed"
,
base_size
=
16
)
+
theme
(
panel.grid.minor.x
=
element_blank
(),
panel.grid.major.x
=
element_blank
(),
# panel.grid.minor.y = element_blank(),
axis.ticks.x
=
element_line
(
color
=
"#000000"
)
# legend.position = "bottom"
)
+
labs
(
title
=
labs_title
,
subtitle
=
labs_subtitle
,
y
=
labs_y
,
x
=
labs_x
,
caption
=
labs_caption
)
p
}
# 1. Cases ------------
# create temp dataframes to be able to plot all the
values in small multiples
data_i_cases_sm
<-
data_i_cases
# create temp dataframes to be able to plot all the values in small multiples
data_i_cases_sm
<-
data_i_cases
data_i_cases_sm
$
region_cp
<-
data_i_cases
$
region
# ----- Small multiple ------------
# Escala lineal
png
(
filename
=
paste
(
"img/italia/covid19_casos-registrados-por-region-lineal.png"
,
sep
=
""
),
width
=
1000
,
height
=
700
)
...
...
@@ -362,6 +407,25 @@ dev.off()
# 2. UCI (intensive care) -------------------
# Escala logarítmica
png
(
filename
=
paste0
(
"img/italia/regions/covid19_casos-registrados-UCI-por-region-lineal.png"
),
width
=
1200
,
height
=
700
)
plot_sm_log
(
df
=
data_i_cases_sm
,
col_date
=
date
,
col_category
=
intensive_care
,
col_group
=
region
,
labs_title
=
"Número de personas (acumulado) en la UCI por COVID-19 registrados en Italia"
,
labs_subtitle
=
paste0
(
"Por comunidad autónoma (escala logarítmica). "
,
period
),
labs_caption
=
caption_i
,
labs_x
=
"fecha"
,
labs_y
=
"personas en UCI"
,
filename
=
"test"
)
ggsave
(
file
=
"img/italia/regions/covid19_casos-registrados-UCI-por-region-log.png"
,
dpi
=
plot_dpi
,
width
=
plot_width
,
height
=
plot_height
,
units
=
plot_units
)
dev.off
()
# 3. Deceassed -------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment