GC.XPN.INTP.CN %>%
bind_rows(NY.GDP.MKTP.CN) %>%
spread(variable, value) %>%
mutate(value = `GC.XPN.INTP.CN`/`NY.GDP.MKTP.CN`) %>%
filter(iso2c %in% c("GR", "IS", "DK")) %>%
left_join(iso2c, by = "iso2c") %>%
year_to_date() %>%
#filter(date >= min(date), !is.na(GC.XPN.INTP.CN), !is.na(NY.GDP.MKTP.CN)) %>%
group_by(Iso2c) %>%
complete(date = seq.Date(min(date), max(date), by = "year")) %>%
left_join(colors, by = c("Iso2c" = "country")) %>%
mutate(color = ifelse(iso2c == "PT", color2, color)) %>%
ggplot(.) + geom_line(aes(x = date, y = value, color = color)) +
theme_minimal() + add_3flags + scale_color_identity() +
xlab("") + ylab("Interest Payments (% of GDP)") +
theme(legend.title = element_blank(),
legend.position = c(0.15, 0.85)) +
add_3flags +
scale_x_date(breaks = seq(1900, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-100, 10000, 1),
labels = percent_format(a = 1)) +
geom_hline(yintercept = 0, linetype = "dashed", color = "grey")