Project Part 2

Interactive and static plots of United States deaths per drug from 1990 to 2015.

1.) Packages I will use to read in and plot the data.

2.) Read in the data from Part 1

deaths_per_drug  <- read_csv(here::here("_posts", "2022-05-03-project-part-1", "deaths-substance-disorders.csv"))

Interactive Graph

deaths_per_drug   %>%
  mutate(Year = paste(Year, "12", "31", sep = "-")) %>%
  e_charts(x = Year) %>%
  e_line(Cocaine, legend = FALSE) %>%
  e_line(Opioid, legend = FALSE) %>%
  e_line(Alcohol, legend = FALSE) %>%
  e_line(Amphetamine, legend = FALSE) %>%
  e_line(Other_Drugs, legend = FALSE) %>%
  e_tooltip(trigger = "axis") %>%
  e_title(text = "Deaths per Drug Abuse in America",
          subtext = "(Per every 5 years), Source: Our World in Data",
          sublink = "https://ourworldindata.org/grapher/deaths-substance-disorders?time=1990..2019&country=~USA")

Save the previous plot to preview.png and add to the yaml chunk at the top

ggsave(filename = "preview.png",
       path = here::here("_posts", "2022-05-13-project-part-2" ))