Skip to content

Instantly share code, notes, and snippets.

@MattCowgill
Created November 4, 2022 01:13
Show Gist options
  • Save MattCowgill/2581fe1ff1c417690921da07751bdc17 to your computer and use it in GitHub Desktop.
Save MattCowgill/2581fe1ff1c417690921da07751bdc17 to your computer and use it in GitHub Desktop.
library(tidyverse)
library(readrba)
forecasts <- rba_forecasts()
latest_two <- forecasts |>
filter(forecast_date %in% c(max(forecast_date),
max(forecast_date) - months(3)))
latest_two |>
filter(!series_desc %in% c("Gross national expenditure", "Public demand",
"Imports", "Terms of trade", "Exports",
"Major trading partner (export-weighted) GDP",
"Dwelling investment")) |>
mutate(forecast_date = format(forecast_date, "%b %Y")) |>
ggplot(aes(x = date, y = value, col = forecast_date)) +
geom_line() +
scale_y_continuous(breaks = \(x) scales::breaks_pretty(3)(x)) +
guides(colour = guide_legend(title = "Forecast issued: ")) +
facet_wrap(~series_desc, scales = "free_y",
nrow = 2,
labeller = label_wrap_gen(18)) +
theme_minimal(base_family = "Roboto",
base_size = 12) +
theme(legend.position = "top",
legend.title = element_text(),
axis.title = element_blank(),
axis.text.y = element_text(size = 10),
plot.margin = margin(5, 10, 5, 5),
panel.grid.minor = element_blank(),
strip.text = element_text(size = 10)) +
labs(title = "Unemployment is expected to rise further and faster than previously forecast",
subtitle = paste0("RBA's forecasts issued in ",
unique(latest_two$forecast_date) |> format("%B %Y") |> paste(collapse = " and ")),
caption = "Source: RBA Statement on Monetary Policy")
ggsave("rba.png", width = 20, height = 15, units = "cm", bg = "white", dpi = "retina")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment