#code for figure 2

library(dplyr)
library(lubridate)
library(ggplot2)
library(Polychrome)

data <- read.csv("Modeled PM2.5 data_clean.csv")

MData <- data
MData <- MData %>% mutate(Date = mdy(Date))

#make color palette
P16 = createPalette(16,  c("#1b9e77", "#d95f02", "#7570b3"))
Swatch_P16 <- swatch(P16)
P16 <- unname(P16)

ggplot(MData, aes(x = Date, y = PM2.5, col = Location)) +
  geom_line() +
  geom_hline(yintercept=35, linetype="dashed", linewidth=0.25) +
  geom_hline(yintercept=20.4, linetype="dashed", linewidth=0.25) +
  labs(y = expression("PM"[2.5]*" (μg/m"^3*")"), 
       x = "Month (2016)",
       title = expression("PM"[2.5]*" concentrations by county in the study area")) +
  scale_color_manual(values = P16) +
  theme_bw()


