gold_us |>
filter(Ticker == "XAUFIXAD") |>
ggplot() +
geom_line(aes(x = date, y = value)) +
ylab("Gold Prices ($/ounce)") + xlab("") +
geom_rect(data = nber_recessions,
aes(xmin = Peak, xmax = Trough, ymin = -Inf, ymax = +Inf),
fill = 'grey', alpha = 0.5) +
scale_y_log10(breaks = c(35, seq(50, 300, 50), seq(0, 2000, 250)),
labels = scales::dollar_format(accuracy = 1)) +
scale_x_date(breaks = as.Date(paste0(c(1971, 1973, 1979, 1990, 2001, 2006, 2007, 2009, 2019), "-01-01")),
labels = date_format("%Y"),
limits = c(as.Date("1970-01-01"), as.Date("2019-01-01"))) +
theme_minimal() +
geom_vline(xintercept = as.Date("1971-08-15"), linetype = "dashed", color = viridis(3)[2])