Balance of payments - BOP

Data - OECD

Structure

Financial account

EU vs. US vs. DE vs. FR

All

Code
BOP |>
  filter(MEASURE == "FA",
         REF_AREA %in% c("USA", "EU27_2020", "DEU", "FRA"),
         FREQ == "Q",
         UNIT_MEASURE == "USD_EXC",
         ACCOUNTING_ENTRY == "N") |>
  arrange(desc(obsTime)) |>
  quarter_to_date() |>
  
  arrange(desc(date)) |>
  mutate(Ref_area = ifelse(REF_AREA == "EU27_2020", "Europe", Ref_area)) |>
  add_flag_color("Ref_area") |>
  mutate(obsValue = obsValue/100) |>
  #filter(date >= as.Date("1999-01-01")) %>%
  #filter(date <= as.Date("2021-01-01")) %>%
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  theme_minimal() + xlab("") + ylab("Financial Account") +
  scale_color_identity() + add_4flags +
  scale_x_date(breaks = c(seq(1949, 2100, 5)) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = seq(-10000, 10000, 500)) +
  geom_hline(yintercept = 0, linetype = "dashed", color = "black")

1999-

Code
BOP |>
  filter(MEASURE == "FA",
         REF_AREA %in% c("USA", "EU27_2020", "DEU", "FRA"),
         FREQ == "Q",
         UNIT_MEASURE == "USD_EXC",
         ACCOUNTING_ENTRY == "N") |>
  quarter_to_date() |>
  
  arrange(desc(date)) |>
  mutate(Ref_area = ifelse(REF_AREA == "EU27_2020", "Europe", Ref_area)) |>
  add_flag_color("Ref_area") |>
  mutate(obsValue = obsValue/100) |>
  filter(date >= as.Date("1999-01-01")) |>
  
  #filter(date <= as.Date("2021-01-01")) %>%
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  theme_minimal() + xlab("") + ylab("Financial Account") +
  scale_color_identity() + add_4flags +
  scale_x_date(breaks = c(seq(1999, 2100, 5)) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = seq(-10000, 10000, 500)) +
  geom_hline(yintercept = 0, linetype = "dashed", color = "black")

Current account (CA, % of GDP)

Greece, EU, US, France

1999-

Quarterly

Code
BOP |>
  filter(MEASURE == "CA",
         REF_AREA %in% c("FRA", "GRC", "USA", "EU27_2020"),
         FREQ == "Q",
         UNIT_MEASURE == "PT_B1GQ") |>
  quarter_to_date() |>
  
  arrange(desc(date)) |>
  mutate(Ref_area = ifelse(REF_AREA == "EU27_2020", "Europe", Ref_area)) |>
  add_flag_color("Ref_area") |>
  mutate(obsValue = obsValue/100) |>
  filter(date >= as.Date("1999-01-01")) |>
  
  #filter(date <= as.Date("2021-01-01")) %>%
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  theme_minimal() + xlab("") + ylab("Current Account, % of GDP") +
  scale_color_identity() + add_2flags +
  scale_x_date(breaks = c(seq(1990, 2100, 2)) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  geom_hline(yintercept = 0, linetype = "dashed", color = "black") +
  geom_label(data = . %>% filter(date == max(date)),
             aes(x = date, y = obsValue, label = percent(obsValue), color = color))

Smoothed

Code
BOP |>
  filter(MEASURE == "CA",
         REF_AREA %in% c("FRA", "GRC", "USA", "EU27_2020"),
         FREQ == "Q",
         UNIT_MEASURE == "PT_B1GQ") |>
  quarter_to_date() |>
  
  arrange(desc(date)) |>
  mutate(Ref_area = ifelse(REF_AREA == "EU27_2020", "Europe", Ref_area)) |>
  add_flag_color("Ref_area") |>
  mutate(obsValue = obsValue/100) |>
  group_by(REF_AREA) |>
  arrange(date) |>
  mutate(obsValue = zoo::rollmean(obsValue, k = 4, fill = NA, align = "right")) |>
  ungroup() |>
  filter(date >= as.Date("1999-01-01")) |>
  
  #filter(date <= as.Date("2021-01-01")) %>%
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  theme_minimal() + xlab("") + ylab("Current Account, % of GDP") +
  scale_color_identity() + add_4flags +
  scale_x_date(breaks = c(seq(1990, 2100, 2)) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  geom_hline(yintercept = 0, linetype = "dashed", color = "black") +
  geom_label(data = . %>% filter(date == max(date)),
             aes(x = date, y = obsValue, label = percent(obsValue), color = color))

Smoothed

Code
BOP |>
  filter(MEASURE == "CA",
         REF_AREA %in% c("FRA", "GRC", "PRT", "IRL"),
         FREQ == "Q",
         UNIT_MEASURE == "PT_B1GQ") |>
  quarter_to_date() |>
  filter(date <= as.Date("2017-01-01")) |>
  
  arrange(desc(date)) |>
  mutate(Ref_area = ifelse(REF_AREA == "EU27_2020", "Europe", Ref_area)) |>
  add_flag_color("Ref_area") |>
  mutate(obsValue = obsValue/100) |>
  group_by(REF_AREA) |>
  arrange(date) |>
  mutate(obsValue = zoo::rollmean(obsValue, k = 4, fill = NA, align = "right")) |>
  ungroup() |>
  filter(date >= as.Date("1999-01-01")) |>
  
  #filter(date <= as.Date("2021-01-01")) %>%
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  theme_minimal() + xlab("") + ylab("Current Account, % of GDP") +
  scale_color_identity() + add_4flags +
  scale_x_date(breaks = c(seq(1990, 2100, 2)) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  geom_hline(yintercept = 0, linetype = "dashed", color = "black") +
  geom_label(data = . %>% filter(date == max(date)),
             aes(x = date, y = obsValue, label = percent(obsValue), color = color))

2003-

Smoothed

Code
BOP |>
  filter(MEASURE == "CA",
         REF_AREA %in% c("FRA", "GRC", "USA", "EU27_2020", "ITA"),
         FREQ == "Q",
         UNIT_MEASURE == "PT_B1GQ") |>
  quarter_to_date() |>
  
  arrange(desc(date)) |>
  mutate(Ref_area = ifelse(REF_AREA == "EU27_2020", "Europe", Ref_area)) |>
  add_flag_color("Ref_area") |>
  mutate(obsValue = obsValue/100) |>
  group_by(REF_AREA) |>
  arrange(date) |>
  mutate(obsValue = zoo::rollmean(obsValue, k = 4, fill = NA, align = "right")) |>
  ungroup() |>
  filter(date >= as.Date("2003-01-01")) |>
  
  #filter(date <= as.Date("2021-01-01")) %>%
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  theme_minimal() + xlab("") + ylab("Current Account, % of GDP") +
  scale_color_identity() + add_5flags +
  scale_x_date(breaks = c(seq(1990, 2100, 2)) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  geom_hline(yintercept = 0, linetype = "dashed", color = "black")

Smoothed (en français)

Code
pays_fr <- c("GRC" = "Grèce", "USA" = "États-Unis", "FRA" = "France",
             "ITA" = "Italie", "EU27_2020" = "Union européenne")
pal <- flag_pal(c("Greece", "United States", "France", "Italy", "Europe"))
names(pal) <- pays_fr
d <- BOP |>
  filter(MEASURE == "CA",
         REF_AREA %in% names(pays_fr),
         FREQ == "Q",
         UNIT_MEASURE == "PT_B1GQ") |>
  quarter_to_date() |>
  group_by(REF_AREA) |>
  arrange(date) |>
  mutate(value = zoo::rollmean(obsValue / 100, k = 4, fill = NA, align = "right")) |>
  ungroup() |>
  filter(date >= as.Date("2003-01-01"), !is.na(value)) |>
  mutate(pays = factor(pays_fr[REF_AREA], levels = pays_fr))
d |>
  ggplot(aes(x = date, y = value, color = pays)) +
  geom_hline(yintercept = 0, linewidth = 0.3, color = "grey40") +
  geom_line(linewidth = 0.6) +
  ggrepel::geom_text_repel(data = d |> slice_max(date, by = pays),
                           aes(label = pays), nudge_x = 300, hjust = 0,
                           direction = "y", segment.size = 0.3, min.segment.length = 0,
                           arrow = arrow(length = unit(0.015, "npc")),
                           size = 3.5, show.legend = FALSE) +
  theme_minimal() + xlab("") +
  ylab("Solde courant (% du PIB, moy. mobile 4 trim.)") +
  scale_x_date(breaks = seq(as.Date("2004-01-01"), max(d$date), "2 years"),
               labels = scales::label_date("%Y"),
               expand = expansion(mult = c(0.01, 0.22))) +
  scale_y_continuous(breaks = 0.01 * seq(-60, 60, 1),
                     labels = scales::label_percent(accuracy = 1, suffix = " %")) +
  scale_color_manual(values = pal) +
  theme(legend.position = "none", panel.grid.minor = element_blank())

Greece, US, France

1999-

Quarterly

Code
BOP |>
  filter(MEASURE == "CA",
         REF_AREA %in% c("FRA", "GRC", "USA"),
         FREQ == "Q",
         UNIT_MEASURE == "PT_B1GQ") |>
  quarter_to_date() |>
  
  arrange(desc(date)) |>
  mutate(Ref_area = ifelse(REF_AREA == "EU27_2020", "Europe", Ref_area)) |>
  add_flag_color("Ref_area") |>
  mutate(obsValue = obsValue/100) |>
  filter(date >= as.Date("1999-01-01")) |>
  
  #filter(date <= as.Date("2021-01-01")) %>%
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  theme_minimal() + xlab("") + ylab("Current Account, % of GDP") +
  scale_color_identity() + add_2flags +
  scale_x_date(breaks = c(seq(1990, 2100, 2)) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  geom_hline(yintercept = 0, linetype = "dashed", color = "black") +
  geom_label(data = . %>% filter(date == max(date)),
             aes(x = date, y = obsValue, label = percent(obsValue), color = color))

Smoothed

Code
BOP |>
  filter(MEASURE == "CA",
         REF_AREA %in% c("FRA", "GRC", "USA"),
         FREQ == "Q",
         UNIT_MEASURE == "PT_B1GQ") |>
  quarter_to_date() |>
  
  arrange(desc(date)) |>
  mutate(Ref_area = ifelse(REF_AREA == "EU27_2020", "Europe", Ref_area)) |>
  add_flag_color("Ref_area") |>
  mutate(obsValue = obsValue/100) |>
  group_by(REF_AREA) |>
  arrange(date) |>
  mutate(obsValue = zoo::rollmean(obsValue, k = 4, fill = NA, align = "right")) |>
  ungroup() |>
  filter(date >= as.Date("1999-01-01")) |>
  
  #filter(date <= as.Date("2021-01-01")) %>%
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  theme_minimal() + xlab("") + ylab("Current Account, % of GDP") +
  scale_color_identity() + add_3flags +
  scale_x_date(breaks = c(seq(1990, 2100, 2)) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  geom_hline(yintercept = 0, linetype = "dashed", color = "black") +
  geom_label(data = . %>% filter(date == max(date)),
             aes(x = date, y = obsValue, label = percent(obsValue), color = color))

EU vs. US

All

Code
BOP |>
  filter(MEASURE == "CA",
         REF_AREA %in% c("USA", "EA20"),
         FREQ == "Q",
         UNIT_MEASURE == "PT_B1GQ") |>
  quarter_to_date() |>
  
  arrange(desc(date)) |>
  mutate(Ref_area = ifelse(REF_AREA == "EA20", "Europe", Ref_area)) |>
  add_flag_color("Ref_area") |>
  mutate(obsValue = obsValue/100) |>
  
  #filter(date <= as.Date("2021-01-01")) %>%
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  theme_minimal() + xlab("") + ylab("Current Account, % of GDP") +
  scale_color_identity() + add_2flags +
  scale_x_date(breaks = seq(1920, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  geom_hline(yintercept = 0, linetype = "dashed", color = "black")

2012-

Code
BOP |>
  filter(MEASURE == "CA",
         REF_AREA %in% c("USA", "EA20"),
         FREQ == "Q",
         UNIT_MEASURE == "PT_B1GQ") |>
  quarter_to_date() |>
  
  arrange(desc(date)) |>
  mutate(Ref_area = ifelse(REF_AREA == "EA20", "Europe", Ref_area)) |>
  add_flag_color("Ref_area") |>
  mutate(obsValue = obsValue/100) |>
  
  filter(date >= as.Date("2013-01-01")) |>
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  theme_minimal() + xlab("") + ylab("Current Account, % of GDP") +
  scale_color_identity() + add_2flags +
  scale_x_date(breaks = seq(1920, 2100, 1) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  geom_hline(yintercept = 0, linetype = "dashed", color = "black")

EU27_2020 vs. US

All

Code
BOP |>
  filter(MEASURE == "CA",
         REF_AREA %in% c("USA", "EU27_2020"),
         FREQ == "Q",
         UNIT_MEASURE == "PT_B1GQ") |>
  quarter_to_date() |>
  
  arrange(desc(date)) |>
  mutate(Ref_area = ifelse(REF_AREA == "EU27_2020", "Europe", Ref_area)) |>
  add_flag_color("Ref_area") |>
  mutate(obsValue = obsValue/100) |>
  
  #filter(date <= as.Date("2021-01-01")) %>%
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  theme_minimal() + xlab("") + ylab("Current Account, % of GDP") +
  scale_color_identity() + add_2flags +
  scale_x_date(breaks = seq(1920, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  geom_hline(yintercept = 0, linetype = "dashed", color = "black")

1999-

Code
BOP |>
  filter(MEASURE == "CA",
         REF_AREA %in% c("USA", "EU27_2020"),
         FREQ == "Q",
         UNIT_MEASURE == "PT_B1GQ") |>
  quarter_to_date() |>
  
  arrange(desc(date)) |>
  mutate(Ref_area = ifelse(REF_AREA == "EU27_2020", "Europe", Ref_area)) |>
  add_flag_color("Ref_area") |>
  mutate(obsValue = obsValue/100) |>
  filter(date >= as.Date("1999-01-01")) |>
  
  #filter(date <= as.Date("2021-01-01")) %>%
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  theme_minimal() + xlab("") + ylab("Current Account, % of GDP") +
  scale_color_identity() + add_2flags +
  scale_x_date(breaks = c(seq(1990, 2100, 2)) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  geom_hline(yintercept = 0, linetype = "dashed", color = "black") +
  geom_label(data = . %>% filter(date == max(date)),
             aes(x = date, y = obsValue, label = percent(obsValue), color = color))

EU vs. US vs. IT

1999-

Code
BOP |>
  filter(MEASURE == "CA",
         REF_AREA %in% c("USA", "EU27_2020", "ITA"),
         FREQ == "Q",
         UNIT_MEASURE == "PT_B1GQ") |>
  quarter_to_date() |>
  
  arrange(desc(date)) |>
  mutate(Ref_area = ifelse(REF_AREA == "EU27_2020", "Europe", Ref_area)) |>
  add_flag_color("Ref_area") |>
  mutate(obsValue = obsValue/100) |>
  filter(date >= as.Date("1999-01-01")) |>
  
  #filter(date <= as.Date("2021-01-01")) %>%
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  theme_minimal() + xlab("") + ylab("Current Account, % of GDP") +
  scale_color_identity() + add_3flags +
  scale_x_date(breaks = c(seq(1997, 2100, 5), seq(1999, 2100, 5)) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  geom_hline(yintercept = 0, linetype = "dashed", color = "black")

EU vs. US vs. DE vs. FR

All

Code
BOP |>
  filter(MEASURE == "CA",
         REF_AREA %in% c("USA", "EU27_2020", "DEU", "FRA"),
         FREQ == "Q",
         UNIT_MEASURE == "PT_B1GQ") |>
  quarter_to_date() |>
  
  arrange(desc(date)) |>
  mutate(Ref_area = ifelse(REF_AREA == "EU27_2020", "Europe", Ref_area)) |>
  add_flag_color("Ref_area") |>
  mutate(obsValue = obsValue/100) |>
  #filter(date >= as.Date("1999-01-01")) %>%
  
  #filter(date <= as.Date("2021-01-01")) %>%
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  theme_minimal() + xlab("") + ylab("Current Account, % of GDP") +
  scale_color_identity() + add_4flags +
  scale_x_date(breaks = c(seq(1949, 2100, 5)) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  geom_hline(yintercept = 0, linetype = "dashed", color = "black")

1999-

Quarterly

Code
BOP |>
  filter(MEASURE == "CA",
         REF_AREA %in% c("USA", "EU27_2020", "DEU", "FRA"),
         FREQ == "Q",
         UNIT_MEASURE == "PT_B1GQ") |>
  quarter_to_date() |>
  
  arrange(desc(date)) |>
  mutate(Ref_area = ifelse(REF_AREA == "EU27_2020", "Europe", Ref_area)) |>
  add_flag_color("Ref_area") |>
  mutate(obsValue = obsValue/100) |>
  filter(date >= as.Date("1999-01-01")) |>
  
  #filter(date <= as.Date("2021-01-01")) %>%
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  theme_minimal() + xlab("") + ylab("Current Account, % of GDP") +
  scale_color_identity() + add_4flags +
  scale_x_date(breaks = c(seq(1997, 2100, 2)) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  geom_hline(yintercept = 0, linetype = "dashed", color = "black")

Smoothed

Quarterly

Code
BOP |>
  filter(MEASURE == "CA",
         REF_AREA %in% c("USA", "EU27_2020", "DEU", "FRA"),
         FREQ == "Q",
         UNIT_MEASURE == "PT_B1GQ") |>
  quarter_to_date() |>
  
  arrange(desc(date)) |>
  mutate(Ref_area = ifelse(REF_AREA == "EU27_2020", "Europe", Ref_area)) |>
  add_flag_color("Ref_area") |>
  mutate(obsValue = obsValue/100) |>
  filter(date >= as.Date("1999-01-01")) |>
  group_by(REF_AREA) |>
  arrange(date) |>
  mutate(obsValue_roll4 = zoo::rollmean(obsValue, k = 4, fill = NA, align = "right")) |>
  ungroup() |>
  
  #filter(date <= as.Date("2021-01-01")) %>%
  ggplot() + geom_line(aes(x = date, y = obsValue_roll4, color = color)) + 
  theme_minimal() + xlab("") + ylab("Current Account, % of GDP") +
  scale_color_identity() + add_4flags +
  scale_x_date(breaks = c(seq(1997, 2100, 2)) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  geom_hline(yintercept = 0, linetype = "dashed", color = "black")

EU vs. US vs. DE

All

Code
BOP |>
  filter(MEASURE == "CA",
         REF_AREA %in% c("USA", "EU27_2020", "DEU"),
         FREQ == "Q",
         UNIT_MEASURE == "PT_B1GQ") |>
  quarter_to_date() |>
  
  arrange(desc(date)) |>
  mutate(Ref_area = ifelse(REF_AREA == "EU27_2020", "Europe", Ref_area)) |>
  add_flag_color("Ref_area") |>
  mutate(obsValue = obsValue/100) |>
  #filter(date >= as.Date("1999-01-01")) %>%
  
  #filter(date <= as.Date("2021-01-01")) %>%
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  theme_minimal() + xlab("") + ylab("Current Account, % of GDP") +
  scale_color_identity() + add_4flags +
  scale_x_date(breaks = c(seq(1949, 2100, 5)) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  geom_hline(yintercept = 0, linetype = "dashed", color = "black")

1999-

Code
BOP |>
  filter(MEASURE == "CA",
         REF_AREA %in% c("USA", "EU27_2020", "DEU"),
         FREQ == "Q",
         UNIT_MEASURE == "PT_B1GQ") |>
  quarter_to_date() |>
  
  arrange(desc(date)) |>
  mutate(Ref_area = ifelse(REF_AREA == "EU27_2020", "Europe", Ref_area)) |>
  add_flag_color("Ref_area") |>
  mutate(obsValue = obsValue/100) |>
  filter(date >= as.Date("1999-01-01")) |>
  
  #filter(date <= as.Date("2021-01-01")) %>%
  ggplot() + geom_line(aes(x = date, y = obsValue, color = color)) + 
  theme_minimal() + xlab("") + ylab("Current Account, % of GDP") +
  scale_color_identity() + add_3flags +
  scale_x_date(breaks = c(seq(1997, 2100, 5), seq(1999, 2100, 5)) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  geom_hline(yintercept = 0, linetype = "dashed", color = "black")