-
Notifications
You must be signed in to change notification settings - Fork 0
/
timeseries-csse-daily-deaths-ggplot.R
66 lines (55 loc) · 2.02 KB
/
timeseries-csse-daily-deaths-ggplot.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
library(tidyverse)
library(ggthemes)
library(ggdark)
library(ggtext)
ggplot() +
#add trend line
geom_line(data = covid19_day1,
aes(x = Day,
y = Deaths_Daily,
colour = Country),
stat = "smooth",
alpha = 0.5,
method = "gam") +
#add points
geom_point(data = covid19_day1,
aes(x = Day,
y = Deaths_Daily,
alpha = Day,
colour = Country,
size = Deaths_Daily)) +
geom_text(data = covid19_day1 %>%
filter(Date == max(Date),
Country != "Canada"),
hjust = -0.2, vjust = -0.5,
aes(x = Day,
y = Deaths_Daily,
label = Country,
colour = Country),
size = 5, alpha = 0.95, family = "bold") +
geom_text(data = covid19_day1 %>%
filter(Date == max(Date),
Country == "Canada"),
hjust = -0.2,
vjust = 0.5,
aes(x = Day,
y = Deaths_Daily,
label = Country,
colour = Country),
size = 5, alpha = 0.95, family = "bold") +
#customize the theme
dark_mode(theme_fivethirtyeight()) +
labs(title = paste0("COVID-19 New Daily Deaths ",max(covid19_day1$Date)),
x = "Days Since First Death",
y = "Deaths per Day",
subtitle = "<span style='color: yellow;'>**Day 1**: _First COVID-19 Death in Country_</span> <br>
**Data Source**: _Johns Hopkins CSSE_ <br>
<span style='color: #cc0000;'>**Source Code**: _github.com/brentthorne/COVID19r_</span>") +
theme(legend.position = "none",
plot.title = element_markdown(size = 30),
plot.subtitle = element_markdown(size = 14),
axis.title = element_markdown(size = 14),
axis.text = element_text(size = 12,face = "bold")) +
# scale_colour_colorblind() +
NULL
ggsave("figures/covid19-daily-deaths.png", width = 11.7, height = 8.68)