T10107_Q |>
quarter_to_date() |>
filter(LineNumber %in% c(1, 4),
date >= as.Date("1980-01-01")) |>
ggplot() + geom_line(aes(x = date, y = DataValue/100, color = LineDescription)) +
theme_minimal() +
scale_color_manual(values = viridis(3)[1:2]) +
theme(legend.title = element_blank(),
legend.position = c(0.8, 0.2)) +
scale_x_date(breaks = seq(1980, 2100, 5) |> paste0("-01-01") |> as.Date(),
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(0, 40, 1),
labels = scales::percent_format(accuracy = 1)) +
geom_rect(data = nber_recessions |>
filter(Peak > as.Date("1980-01-01")),
aes(xmin = Peak, xmax = Trough, ymin = -Inf, ymax = +Inf),
fill = 'grey', alpha = 0.5) +
xlab("") + ylab("Prices for Gross Domestic Product, Percent Change")