External balance on goods and services (% of GDP)

Data - WDI

Info

Last observation: 2025 (N = 11,332)

First observation: 1960 (N = 11,332)

Last data update: 13 aoû 2026, 22:40. Last compile: 13 aoû 2026, 23:22

Info

source dataset Title .html .rData
wdi NE.RSB.GNFS.ZS External balance on goods and services (% of GDP) 2026-08-12 2026-08-12
wdi BN.CAB.XOKA.GD.ZS Current account balance (% of GDP) 2026-08-12 2026-08-12

Data on main macro

source dataset Title .html .rData
wdi NE.RSB.GNFS.ZS External balance on goods and services (% of GDP) 2026-08-12 2026-08-12
eurostat nama_10_a10 Gross value added and income by A*10 industry breakdowns 2026-08-13 2026-08-12
eurostat nama_10_a10_e Employment by A*10 industry breakdowns 2026-08-13 2026-08-13
eurostat nama_10_gdp GDP and main components (output, expenditure and income) 2026-08-13 2026-08-12
eurostat nama_10_lp_ulc Labour productivity and unit labour costs 2026-08-13 2026-08-12
eurostat namq_10_a10 Gross value added and income A*10 industry breakdowns 2026-08-13 2026-08-12
eurostat namq_10_a10_e Employment A*10 industry breakdowns 2026-08-13 2026-08-12
eurostat namq_10_gdp GDP and main components (output, expenditure and income) 2026-08-13 2026-08-12
eurostat namq_10_lp_ulc Labour productivity and unit labour costs 2026-08-13 2026-08-12
eurostat namq_10_pc Main GDP aggregates per capita 2026-08-13 2026-08-12
eurostat nasa_10_nf_tr Non-financial transactions 2026-08-13 2026-08-12
eurostat nasq_10_nf_tr Non-financial transactions 2026-08-13 2026-08-13
fred gdp Gross Domestic Product 2026-08-12 2026-08-12
oecd QNA Quarterly National Accounts 2026-08-13 2026-08-12
oecd SNA_TABLE1 Gross domestic product (GDP) 2026-08-13 2026-08-02
oecd SNA_TABLE14A Non-financial accounts by sectors 2026-08-13 2026-08-02
oecd SNA_TABLE2 Disposable income and net lending - net borrowing 2026-08-13 2026-08-02
oecd SNA_TABLE6A Value added and its components by activity, ISIC rev4 2026-08-13 2026-08-02
wdi NY.GDP.MKTP.CD GDP (current USD) 2026-08-12 2026-08-12
wdi NY.GDP.MKTP.PP.CD GDP, PPP (current international D) 2026-08-12 2026-08-12
wdi NY.GDP.PCAP.CD GDP per capita (current USD) 2026-08-12 2026-08-12
wdi NY.GDP.PCAP.KD GDP per capita (constant 2015 USD) 2026-08-12 2026-08-12
wdi NY.GDP.PCAP.PP.CD GDP per capita, PPP (current international D) 2026-08-12 2026-08-12
wdi NY.GDP.PCAP.PP.KD GDP per capita, PPP (constant 2011 international D) 2026-08-12 2026-08-12

LAST_COMPILE

LAST_COMPILE
2026-08-13

Last

Code
NE.RSB.GNFS.ZS |>
  group_by(year) |>
  summarise(Nobs = n()) |>
  arrange(desc(year)) |>
  head(1) |>
  print_table_conditional()
year Nobs
2025 177

Nobs - Javascript

Code
NE.RSB.GNFS.ZS |>
  left_join(iso2c, by = "iso2c") |>
  group_by(iso2c, Iso2c) |>
  mutate(value = round(value, 2)) |>
  summarise(Nobs = n(),
            `Year 1` = first(year),
            `NX 1 (%)` = first(value),
            `Year 2` = last(year),
            `NX 2 (%)` = last(value)) |>
  arrange(-Nobs) |>
  mutate(Flag = gsub(" ", "-", str_to_lower(Iso2c)),
         Flag = paste0('<img src="../../bib/flags/vsmall/', Flag, '.png" alt="Flag">')) |>
  select(Flag, everything()) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .}

Crises in Emerging Markets (Source: Vegh (2013))

1982: Southern Cone - Argentina, Chile, Uruguay

Code
NE.RSB.GNFS.ZS |>
  year_to_date() |>
  filter(iso2c %in% c("AR", "CL", "UY"),
         date >= as.Date("1976-01-01"),
         date <= as.Date("1987-01-01")) |>
  left_join(iso2c, by = "iso2c") |>
  left_join(colors, by = c("Iso2c" = "country")) |>
  mutate(value = value/100) |>
  ggplot() + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + scale_color_identity() + add_flags +
  scale_x_date(breaks = seq(1950, 2100, 2) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 2),
                     labels = scales::percent_format(accuracy = 1)) +
  xlab("") + ylab("Net Exports (% of GDP)") + 
  geom_hline(yintercept = 0, linetype = "dashed",  color = "black")

1994: Mexico

Code
WDI |>
  left_join(iso3c, by = "iso3c") |>
  filter(iso2c %in% c("MX"),
         INDICATOR %in% c("NE.RSB.GNFS.ZS", "BN.CAB.XOKA.GD.ZS"),
         date <= as.Date("1999-01-01"),
         date >= as.Date("1989-01-01")) |>
  left_join(INDICATOR, by = "INDICATOR") |>
  ggplot() + xlab("") + ylab("Net Exports (% of GDP)") + 
  geom_line(aes(x = date, y = value/100, color = Indicator, linetype = Indicator)) + 
  theme_minimal() + scale_color_manual(values = viridis(3)[1:2]) +
  theme(legend.title = element_blank(),
        legend.position = c(0.3, 0.9)) +
  scale_x_date(breaks = seq(1950, 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")

1997: Russia

Code
WDI |>
  left_join(iso3c, by = "iso3c") |>
  filter(iso2c %in% c("RU"),
         INDICATOR %in% c("NE.RSB.GNFS.ZS", "BN.CAB.XOKA.GD.ZS"),
         date <= as.Date("2002-01-01"),
         date >= as.Date("1980-01-01")) |>
  left_join(INDICATOR, by = "INDICATOR") |>
  ggplot() + xlab("") + ylab("Net Exports (% of GDP)") + 
  geom_line(aes(x = date, y = value/100, color = Indicator, linetype = Indicator)) + 
  theme_minimal() + scale_color_manual(values = viridis(3)[1:2]) +
  theme(legend.title = element_blank(),
        legend.position = c(0.3, 0.9)) +
  scale_x_date(breaks = seq(1950, 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")

1997: East Asia - Indonesia, Korea, Malaysia, Thailand

Code
NE.RSB.GNFS.ZS |>
  year_to_date() |>
  filter(iso2c %in% c("ID", "KR", "MY", "TH"),
         date <= as.Date("2002-01-01"),
         date >= as.Date("1992-01-01")) |>
  left_join(iso2c, by = "iso2c") |>
  left_join(colors, by = c("Iso2c" = "country")) |>
  mutate(value = value/100) |>
  ggplot() + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + scale_color_identity() + add_flags +
  scale_x_date(breaks = seq(1950, 2100, 1) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 2),
                     labels = scales::percent_format(accuracy = 1)) +
  xlab("") + ylab("Net Exports (% of GDP)") + 
  geom_hline(yintercept = 0, linetype = "dashed",  color = "black")

2001: Turkey

Code
WDI |>
  left_join(iso3c, by = "iso3c") |>
  filter(iso2c %in% c("TR"),
         INDICATOR %in% c("NE.RSB.GNFS.ZS", "BN.CAB.XOKA.GD.ZS"),
         date <= as.Date("2006-01-01"),
         date >= as.Date("1996-01-01")) |>
  left_join(INDICATOR, by = "INDICATOR") |>
  ggplot() + xlab("") + ylab("Net Exports (% of GDP)") + 
  geom_line(aes(x = date, y = value/100, color = Indicator, linetype = Indicator)) + 
  theme_minimal() + scale_color_manual(values = viridis(3)[1:2]) +
  theme(legend.title = element_blank(),
        legend.position = c(0.3, 0.9)) +
  scale_x_date(breaks = seq(1950, 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")

Israel

All

Code
WDI |>
  left_join(iso3c, by = "iso3c") |>
  filter(iso2c %in% c("IL"),
         INDICATOR %in% c("NE.RSB.GNFS.ZS", "BN.CAB.XOKA.GD.ZS")) |>
  left_join(INDICATOR, by = "INDICATOR") |>
  ggplot() + xlab("") + ylab("Net Exports (% of GDP)") + 
  geom_line(aes(x = date, y = value/100, color = Indicator, linetype = Indicator)) + 
  theme_minimal() + scale_color_manual(values = viridis(3)[1:2]) +
  theme(legend.title = element_blank(),
        legend.position = c(0.7, 0.2)) +
  scale_x_date(breaks = seq(1950, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 2),
                     labels = scales::percent_format(accuracy = 1)) +
  geom_hline(yintercept = 0, linetype = "dashed",  color = "black")

1990

Code
WDI |>
  left_join(iso3c, by = "iso3c") |>
  filter(iso2c %in% c("IL"),
         INDICATOR %in% c("NE.RSB.GNFS.ZS", "BN.CAB.XOKA.GD.ZS"),
         date >= as.Date("1990-01-01")) |>
  left_join(INDICATOR, by = "INDICATOR") |>
  ggplot() + xlab("") + ylab("Net Exports (% of GDP)") + 
  geom_line(aes(x = date, y = value/100, color = Indicator, linetype = Indicator)) + 
  theme_minimal() + scale_color_manual(values = viridis(3)[1:2]) +
  theme(legend.title = element_blank(),
        legend.position = c(0.7, 0.2)) +
  scale_x_date(breaks = seq(1950, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 2),
                     labels = scales::percent_format(accuracy = 1)) +
  geom_hline(yintercept = 0, linetype = "dashed",  color = "black")

2000

Code
WDI |>
  left_join(iso3c, by = "iso3c") |>
  filter(iso2c %in% c("IL"),
         INDICATOR %in% c("NE.RSB.GNFS.ZS", "BN.CAB.XOKA.GD.ZS"),
         date >= as.Date("2000-01-01")) |>
  left_join(INDICATOR, by = "INDICATOR") |>
  ggplot() + xlab("") + ylab("Net Exports (% of GDP)") + 
  geom_line(aes(x = date, y = value/100, color = Indicator, linetype = Indicator)) + 
  theme_minimal() + scale_color_manual(values = viridis(3)[1:2]) +
  theme(legend.title = element_blank(),
        legend.position = c(0.7, 0.2)) +
  scale_x_date(breaks = seq(1950, 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")

1989-1999

Code
WDI |>
  left_join(iso3c, by = "iso3c") |>
  filter(iso2c %in% c("IL"),
         INDICATOR %in% c("NE.RSB.GNFS.ZS", "BN.CAB.XOKA.GD.ZS"),
         date <= as.Date("1999-01-01"),
         date >= as.Date("1989-01-01")) |>
  left_join(INDICATOR, by = "INDICATOR") |>
  ggplot() + xlab("") + ylab("Net Exports (% of GDP)") + 
  geom_line(aes(x = date, y = value/100, color = Indicator, linetype = Indicator)) + 
  theme_minimal() + scale_color_manual(values = viridis(3)[1:2]) +
  theme(legend.title = element_blank(),
        legend.position = c(0.3, 0.9)) +
  scale_x_date(breaks = seq(1950, 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")

Vietnam

Code
WDI |>
  left_join(iso3c, by = "iso3c") |>
  filter(iso2c %in% c("VN"),
         INDICATOR %in% c("NE.RSB.GNFS.ZS", "BN.CAB.XOKA.GD.ZS")) |>
  left_join(INDICATOR, by = "INDICATOR") |>
  ggplot() + xlab("") + ylab("Net Exports (% of GDP)") + 
  geom_line(aes(x = date, y = value/100, color = Indicator, linetype = Indicator)) + 
  theme_minimal() + scale_color_manual(values = viridis(3)[1:2]) +
  theme(legend.title = element_blank(),
        legend.position = c(0.3, 0.95)) +
  scale_x_date(breaks = seq(1950, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 2),
                     labels = scales::percent_format(accuracy = 1)) +
  geom_hline(yintercept = 0, linetype = "dashed",  color = "black")

Afghanistan

All

Code
WDI |>
  left_join(iso3c, by = "iso3c") |>
  filter(iso2c %in% c("AF"),
         INDICATOR %in% c("NE.RSB.GNFS.ZS", "BN.CAB.XOKA.GD.ZS")) |>
  left_join(INDICATOR, by = "INDICATOR") |>
  ggplot() + xlab("") + ylab("Net Exports (% of GDP)") + 
  geom_line(aes(x = date, y = value/100, color = Indicator, linetype = Indicator)) + 
  theme_minimal() + scale_color_manual(values = viridis(3)[1:2]) +
  theme(legend.title = element_blank(),
        legend.position = c(0.3, 0.95)) +
  scale_x_date(breaks = seq(1950, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 2),
                     labels = scales::percent_format(accuracy = 1)) +
  geom_hline(yintercept = 0, linetype = "dashed",  color = "black")

2008-

Code
WDI |>
  left_join(iso3c, by = "iso3c") |>
  filter(iso2c %in% c("AF"),
         INDICATOR %in% c("NE.RSB.GNFS.ZS", "BN.CAB.XOKA.GD.ZS")) |>
  filter(date >= as.Date("2008-01-01")) |>
  left_join(INDICATOR, by = "INDICATOR") |>
  ggplot() + xlab("") + ylab("External Balance, Current Account (% of GDP)") + 
  geom_line(aes(x = date, y = value/100, color = Indicator, linetype = Indicator)) + 
  theme_minimal() + scale_color_manual(values = viridis(3)[1:2]) +
  theme(legend.title = element_blank(),
        legend.position = c(0.7, 0.8)) +
  scale_x_date(breaks = seq(1950, 2100, 1) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 5),
                     labels = scales::percent_format(accuracy = 1)) +
  geom_hline(yintercept = 0, linetype = "dashed",  color = "black")

China

Code
WDI |>
  left_join(iso3c, by = "iso3c") |>
  filter(iso2c %in% c("VN"),
         INDICATOR %in% c("NE.RSB.GNFS.ZS", "BN.CAB.XOKA.GD.ZS")) |>
  left_join(INDICATOR, by = "INDICATOR") |>
  ggplot() + xlab("") + ylab("Net Exports (% of GDP)") + 
  geom_line(aes(x = date, y = value/100, color = Indicator, linetype = Indicator)) + 
  theme_minimal() + scale_color_manual(values = viridis(3)[1:2]) +
  theme(legend.title = element_blank(),
        legend.position = c(0.3, 0.95)) +
  scale_x_date(breaks = seq(1950, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 2),
                     labels = scales::percent_format(accuracy = 1)) +
  geom_hline(yintercept = 0, linetype = "dashed",  color = "black")

Sweden

Code
WDI |>
  left_join(iso3c, by = "iso3c") |>
  filter(iso2c %in% c("SE"),
         INDICATOR %in% c("NE.RSB.GNFS.ZS", "BN.CAB.XOKA.GD.ZS")) |>
  left_join(INDICATOR, by = "INDICATOR") |>
  ggplot() + xlab("") + ylab("Net Exports (% of GDP)") + 
  geom_line(aes(x = date, y = value/100, color = Indicator, linetype = Indicator)) + 
  theme_minimal() + scale_color_manual(values = viridis(3)[1:2]) +
  theme(legend.title = element_blank(),
        legend.position = c(0.3, 0.95)) +
  scale_x_date(breaks = seq(1950, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 2),
                     labels = scales::percent_format(accuracy = 1)) +
  geom_hline(yintercept = 0, linetype = "dashed",  color = "black")

Germany

Code
WDI |>
  left_join(iso3c, by = "iso3c") |>
  filter(iso2c %in% c("DE"),
         INDICATOR %in% c("NE.RSB.GNFS.ZS", "BN.CAB.XOKA.GD.ZS")) |>
  left_join(INDICATOR, by = "INDICATOR") |>
  ggplot() + xlab("") + ylab("Net Exports (% of GDP)") + 
  geom_line(aes(x = date, y = value/100, color = Indicator, linetype = Indicator)) + 
  theme_minimal() + scale_color_manual(values = viridis(3)[1:2]) +
  theme(legend.title = element_blank(),
        legend.position = c(0.3, 0.95)) +
  scale_x_date(breaks = seq(1950, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 2),
                     labels = scales::percent_format(accuracy = 1)) +
  geom_hline(yintercept = 0, linetype = "dashed",  color = "black")

France, New Zealand, Switzerland

Code
NE.RSB.GNFS.ZS |>
  filter(iso2c %in% c("NZ", "FR", "CH")) |>
  left_join(iso2c, by = "iso2c") |>
  year_to_date() |>
  filter(date >= as.Date("1990-01-01")) |>
  left_join(colors, by = c("Iso2c" = "country")) |>
  mutate(value = value/100) |>
  ggplot() + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + scale_color_identity() + add_flags +
  scale_x_date(breaks = seq(1950, 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)) +
  xlab("") + ylab("Net Exports (% of GDP)") + 
  geom_hline(yintercept = 0, linetype = "dashed",  color = "black")

France, Germany, Italy

Viridis

Code
NE.RSB.GNFS.ZS |>
  filter(iso2c %in% c("IT", "FR", "DE")) |>
  left_join(iso2c, by = "iso2c") |>
  year_to_date() |>
  left_join(colors, by = c("Iso2c" = "country")) |>
  mutate(value = value/100) |>
  ggplot() + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + scale_color_identity() + add_flags +
  scale_x_date(breaks = seq(1950, 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)) +
  xlab("") + ylab("Net Exports (% of GDP)") + 
  geom_hline(yintercept = 0, linetype = "dashed",  color = "black")

Flags

Code
NE.RSB.GNFS.ZS |>
  filter(iso2c %in% c("IT", "FR", "DE")) |>
  left_join(iso2c, by = "iso2c") |>
  year_to_date() |>
  left_join(colors, by = c("Iso2c" = "country")) |>
  mutate(value = value/100) |>
  ggplot() + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + scale_color_identity() + add_flags +
  scale_x_date(breaks = seq(1950, 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")

Germany, France, Switzerland

Code
NE.RSB.GNFS.ZS |>
  left_join(iso2c, by = "iso2c") |>
  year_to_date() |>
  filter(iso2c %in% c("CH", "FR", "DE"),
         date >= as.Date("1970-01-01")) |>
  left_join(colors, by = c("Iso2c" = "country")) |>
  mutate(value = value/100) |>
  ggplot() + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + scale_color_identity() + add_flags +
  scale_x_date(breaks = seq(1950, 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),
                     limits = c(-0.05, 0.14)) +
  xlab("") + ylab("Exportations Nettes (% du PIB)") + 
  geom_hline(yintercept = 0, linetype = "dashed",  color = "grey")

Poland, Hungary, Czech Republic

Code
NE.RSB.GNFS.ZS |>
  left_join(iso2c, by = "iso2c") |>
  year_to_date() |>
  filter(iso2c %in% c("PL", "HU", "CZ"),
         date >= as.Date("1970-01-01")) |>
  left_join(colors, by = c("Iso2c" = "country")) |>
  mutate(value = value/100) |>
  ggplot() + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + scale_color_identity() + add_flags +
  scale_x_date(breaks = seq(1950, 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)) +
  xlab("") + ylab("Exportations Nettes (% du PIB)") + 
  geom_hline(yintercept = 0, linetype = "dashed",  color = "grey")

France, Spain, Portugal

Code
NE.RSB.GNFS.ZS |>
  left_join(iso2c, by = "iso2c") |>
  year_to_date() |>
  filter(iso2c %in% c("ES", "FR", "DE", "PT"),
         date >= as.Date("1970-01-01")) |>
  left_join(colors, by = c("Iso2c" = "country")) |>
  mutate(value = value/100) |>
  ggplot() + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + scale_color_identity() + add_flags +
  scale_x_date(breaks = seq(1950, 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)) +
  xlab("") + ylab("Exportations Nettes (% du PIB)") + 
  geom_hline(yintercept = 0, linetype = "dashed",  color = "grey")

Germany, France, China

Code
NE.RSB.GNFS.ZS |>
  left_join(iso2c, by = "iso2c") |>
  year_to_date() |>
  filter(iso2c %in% c("CN", "FR", "DE"),
         date >= as.Date("1970-01-01")) |>
  left_join(colors, by = c("Iso2c" = "country")) |>
  mutate(value = value/100) |>
  ggplot() + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + scale_color_identity() + add_flags +
  scale_x_date(breaks = seq(1950, 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),
                     limits = c(-0.05, 0.09)) +
  xlab("") + ylab("External balance on goods and services (% of GDP)") + 
  geom_hline(yintercept = 0, linetype = "dashed",  color = "grey")

Germany, France, China, United States

Code
NE.RSB.GNFS.ZS |>
  left_join(iso2c, by = "iso2c") |>
  year_to_date() |>
  filter(iso2c %in% c("CN", "FR", "DE", "US"),
         date >= as.Date("1970-01-01")) |>
  left_join(colors, by = c("Iso2c" = "country")) |>
  mutate(value = value/100) |>
  ggplot() + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + scale_color_identity() + add_flags +
  scale_x_date(breaks = seq(1950, 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)) +
  xlab("") + ylab("External balance on goods and services (% of GDP)") + 
  geom_hline(yintercept = 0, linetype = "dashed",  color = "grey")

Saudi Arabia, Jordan, Kuwait

Code
NE.RSB.GNFS.ZS |>
  filter(iso2c %in% c("SA", "JO", "KW")) |>
  left_join(iso2c, by = "iso2c") |>
  year_to_date() |>
  left_join(colors, by = c("Iso2c" = "country")) |>
  mutate(value = value/100) |>
  ggplot() + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + scale_color_identity() + add_flags +
  scale_x_date(breaks = seq(1950, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-200, 200, 10),
                     labels = scales::percent_format(accuracy = 1)) +
  xlab("") + ylab("Net Exports (% of GDP)") + 
  geom_hline(yintercept = 0, linetype = "dashed",  color = "black")

Lebanon, Barbados, Italy

Code
NE.RSB.GNFS.ZS |>
  filter(iso2c %in% c("LB", "BB", "IT"),
         year >= 2000) |>
  left_join(iso2c, by = "iso2c") |>
  year_to_date() |>
  left_join(colors, by = c("Iso2c" = "country")) |>
  mutate(value = value/100) |>
  ggplot() + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + scale_color_identity() + add_flags +
  scale_x_date(breaks = seq(1950, 2100, 1) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 5),
                     labels = scales::percent_format(accuracy = 1),
                     limits = c(-0.35, 0.05)) +
  xlab("") + ylab("External balance on goods and services (% of GDP)") + 
  geom_hline(yintercept = 0, linetype = "dashed",  color = "black")

Canada, Israel, The Netherlands

Code
NE.RSB.GNFS.ZS |>
  filter(iso2c %in% c("CA", "IL", "NL")) |>
  left_join(iso2c, by = "iso2c") |>
  year_to_date() |>
  left_join(colors, by = c("Iso2c" = "country")) |>
  mutate(value = value/100) |>
  ggplot() + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + scale_color_identity() + add_flags +
  scale_x_date(breaks = seq(1950, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 2),
                     labels = scales::percent_format(accuracy = 1)) +
  xlab("") + ylab("Net Exports (% of GDP)") + 
  geom_hline(yintercept = 0, linetype = "dashed",  color = "black")

Argentina, Chile, Uruguay

Code
NE.RSB.GNFS.ZS |>
  filter(iso2c %in% c("AR", "CL", "UY")) |>
  left_join(iso2c, by = "iso2c") |>
  year_to_date() |>
  left_join(colors, by = c("Iso2c" = "country")) |>
  mutate(value = value/100) |>
  ggplot() + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + scale_color_identity() + add_flags +
  scale_x_date(breaks = seq(1950, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 2),
                     labels = scales::percent_format(accuracy = 1)) +
  xlab("") + ylab("Net Exports (% of GDP)") + 
  geom_hline(yintercept = 0, linetype = "dashed",  color = "black")

China, Germany, United States

Viridis

Code
NE.RSB.GNFS.ZS |>
  filter(iso2c %in% c("CN", "US", "DE")) |>
  left_join(iso2c, by = "iso2c") |>
  year_to_date() |>
  left_join(colors, by = c("Iso2c" = "country")) |>
  mutate(value = value/100) |>
  ggplot() + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + scale_color_identity() + add_flags +
  scale_x_date(breaks = seq(1950, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 2),
                     labels = scales::percent_format(accuracy = 1)) +
  xlab("") + ylab("Net Exports (% of GDP)") + 
  geom_hline(yintercept = 0, linetype = "dashed",  color = "black")

Flags

Code
NE.RSB.GNFS.ZS |>
  filter(iso2c %in% c("CN", "US", "DE")) |>
  left_join(iso2c, by = "iso2c") |>
  year_to_date() |>
  left_join(colors, by = c("Iso2c" = "country")) |>
  mutate(value = value/100) |>
  ggplot() + geom_line(aes(x = date, y = value, color = color)) +
  theme_minimal() + scale_color_identity() + add_flags +
  scale_x_date(breaks = seq(1950, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 2),
                     labels = scales::percent_format(accuracy = 1)) +
  xlab("") + ylab("Net Exports (% of GDP)") + 
  geom_hline(yintercept = 0, linetype = "dashed",  color = "black")