Project Part 2

Interative and static plots of drug related deaths in 2019.

Nicholas Dean true
2022-05-17
  1. Packages I will use to read in and plot the data.
  1. Read the data in from part 1
direct_deaths <- read_csv(here::here("_posts/2022-05-10-project-part-1/direct_deaths.csv"))

Interactive graph

direct_deaths %>%
  pivot_longer(cols = 1:5, names_to = "desc", values_to = "n") %>% 
  arrange(n) %>% 
  e_charts(desc) %>% 
  e_bar(n, legend = FALSE) %>% 
  e_tooltip(trigger = "axis")%>%
  e_flip_coords() %>% 
  e_title(text = "Drug usage and Direct deaths worldwide")

Static Group

direct_deaths %>%
  pivot_longer(cols = 1:5, names_to = "desc", values_to = "n") %>% 
  ggplot(aes(x =desc, y=n))+
geom_col()+
  coord_flip()+
theme_classic()+
theme(legend.position = "bottom")
labs(y = "millions",
     fill = NULL)
$y
[1] "millions"

$fill
NULL

attr(,"class")
[1] "labels"

This graph shows the importance of drug related education, in order to lower deaths, and save lives.

ggsave(filename = here::here("_posts/2022-05-17-project-part-2/preview.png"))