cpi |>
filter(iso3c %in% c("USA", "FRA", "ITA", "JPN", "GBR"),
variable == "CPM",
date >= as.Date("1925-01-01"),
date <= as.Date("1970-01-01")) |>
left_join(iso3c, by = "iso3c") |>
group_by(iso3c) |>
mutate(value = 1*value / value[date == as.Date("1925-01-31")]) |>
ggplot() + geom_line(aes(x = date, y = value, color = Iso3c, linetype = Iso3c)) +
theme_minimal() + xlab("") + ylab("Price Index (Log Scale, 1925 = 1)") +
scale_x_date(breaks = seq(1925, 2100, 5) |> paste0("-01-01") |> as.Date(),
labels = date_format("%Y")) +
geom_image(data = . %>%
filter(date == as.Date("1969-12-31")) %>%
mutate(image = paste0("../../icon/flag/", str_to_lower(gsub(" ", "-", Iso3c)), ".png")),
aes(x = date, y = value, image = image), asp = 1.5) +
scale_y_log10(breaks = c(1, c(1, 2, 3, 5, 7, 10), 10*c(1, 2, 3, 5, 7, 10), 100*c(1, 2, 3, 5, 7, 10)),
labels = dollar_format(accuracy = 1, prefix = "")) +
scale_color_manual(values = c("#000000", "#009246", "#BC002D", "#6E82B5", "#B22234")) +
scale_linetype_manual(values = c("solid", "solid","longdash","solid", "solid")) +
theme(legend.position = "none")