statistia-netcontrib.csv
country,netcontrib
DE,25572
FR,12380
NL,6929
IT,3337
SE,2826
DK,1766
AT,1540
FI,1109
IE,703
MT,-14
CY,-172
SI,-386
EE,-729
LT,-860
SK,-1398
LV,-1544
BG,-1727
HR,-1746
ES,-1946
LU,-2020
CZ,-2853
BE,-2950
PT,-3132
RO,-4096
HU,-4206
GR,-4278
PL,-11910
eu-contribution-per-capita.r
if (!require("pacman")) install.packages("pacman")
pacman::p_load(
countrycode,
dplyr,
ggdark,
ggplot2,
r2country
)
abs <- read.csv("statista-netcontrib.csv",header = TRUE)
abs2 <- cbind(abs,name = countrycode(abs$country,"iso2c","country.name"))
df <- inner_join(country_names, abs2)
df2 <- inner_join(country_population, df)
df2$percap <- df2$netcontrib/df2$population2023*1000000
df3 <- arrange(df2,percap)
ggplot(df3, aes(x = percap, y = reorder(name, percap))) +
geom_bar(stat = "identity") +
dark_theme_gray() +
ylab("Country") +
xlab("Euros per capita") +
scale_x_continuous(breaks = scales::pretty_breaks(n = 20)) +
geom_text(aes(label = percap))
ggsave("euros-percap.png")

Sorry about the broken escaping of the angle brackets (โ<โ is โ<โ) in the source; Lemmy is, regrettably, broken on that at the moment.
EDIT: Fixed Latvia country code error.
EDIT2: And Austria country code error.