options(scipen = 100000)
library(tidyverse)
library(plotly)
library(readr)
deficit <- read_csv("~/Downloads/FYFSD (1).csv")

options(scipen = 100000)


blue <- "#00AEF3"
red <- "#E81B23"
grey <- "#333333"

deficit %>% 
  filter(DATE > 1979) %>% 
  ggplot(aes(DATE, FYFSD)) +
  geom_ribbon(aes(xmin = as.Date("2020", "%Y"), xmax = as.Date("2022", "%Y")), alpha = .5, fill=blue, color="black") +
  geom_ribbon(aes(xmin = as.Date("2016", "%Y"), xmax = as.Date("2020", "%Y")), alpha = .5, fill=red, color="black") +
  geom_ribbon(aes(xmin = as.Date("2008", "%Y"), xmax = as.Date("2016", "%Y")), alpha = .5, fill=blue, color="black") + 
  geom_ribbon(aes(xmin = as.Date("2000", "%Y"), xmax = as.Date("2008", "%Y")), alpha = .5, fill=red, color="black") + 
  geom_ribbon(aes(xmin = as.Date("1992", "%Y"), xmax = as.Date("2000", "%Y")), alpha = .5, fill=blue, color="black") + 
  geom_ribbon(aes(xmin = as.Date("1988", "%Y"), xmax = as.Date("1992", "%Y")), alpha = .5, fill=red, color="black") +
  geom_ribbon(aes(xmin = as.Date("1980", "%Y"), xmax = as.Date("1988", "%Y")), alpha = .5, fill=red, color="black") +
 geom_path(color=grey,size = 3, lineend = "round") +
  theme_minimal() -> viz1
  
viz1 + 
  annotate("text", x = as.Date("2021", "%Y"), y = -2000000, label = "Biden Presidency", angle="90") +
  annotate("text", x = as.Date("2018", "%Y"), y = -2000000, label = "Trump Presidency", angle="90") +
  annotate("text", x = as.Date("2012", "%Y"), y = -2000000, label = "Obama Presidency", angle="90") +
  annotate("text", x = as.Date("2004", "%Y"), y = -2000000, label = "Bush Presidency", angle="90") +
  annotate("text", x = as.Date("1996", "%Y"), y = -2000000, label = "Clinton Presidency", angle="90") +
  annotate("text", x = as.Date("1990", "%Y"), y = -2000000, label = "Bush Sr. Presidency", angle="90") +
  annotate("text", x = as.Date("1984", "%Y"), y = -2000000, label = "Reagan Presidency", angle="90") +
  ggtitle('Federal Deficit ~ Party in Power') +
  theme(
    plot.title=element_text( hjust=1, vjust=0.5, face='bold')
  ) +
  ylab('$$$')