Created
May 2, 2024 11:22
-
-
Save mschnetzer/b972cd5d96d8eb8dcc932965afd01db8 to your computer and use it in GitHub Desktop.
VAT along the income distribution (https://x.com/matschnetzer/status/1785992917552644564)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(eurostat) | |
library(ggflags) | |
library(countrycode) | |
library(geomtextpath) | |
library(ggtext) | |
data <- get_eurostat("icw_tax_03") | |
plotdat <- data |> | |
filter(quantile == "MED", | |
quant_inc != "TOTAL", | |
geo %in% c("AT", "DE", "FR", "DK", "ES", "PL", "SK", "BE")) |> | |
mutate(year = factor(year(TIME_PERIOD))) | |
plotdat |> | |
ggplot(aes(x = quant_inc, y = values, group = year, color = year)) + | |
geom_line(aes(linewidth = year)) + | |
geom_labelline(aes(label = year), size = 2.3, family = "Barlow Condensed", | |
linewidth = 0, label.padding = unit(1, "pt"), | |
fill = "transparent") + | |
geom_flag(aes(x = "QU2", y = 23, country = tolower(geo)), size = 6, | |
data = ~. |> filter(year == 2020) |> slice(1, .by = geo)) + | |
geom_text(aes(x = "QU2", y = 23, label = toupper(countrycode(geo, origin = "iso2c", destination = "country.name.de"))), nudge_x = .4, hjust = 0, | |
family = "Barlow Condensed", size = 4, color = "black", | |
data = ~. |> filter(year == 2020) |> slice(1, .by = geo)) + | |
geom_text(aes(label = values), size = 2.5, family = "Barlow Condensed", | |
color = "black", nudge_x = -.1, hjust = 1, | |
data = ~. |> filter(year == 2020, quant_inc == "QU1")) + | |
geom_text(aes(label = values), size = 2.5, family = "Barlow Condensed", | |
color = "black", nudge_x = .1, hjust = 0, | |
data = ~. |> filter(year == 2020, quant_inc == "QU5")) + | |
facet_wrap(~geo, nrow = 2) + | |
scale_linewidth_manual(values = c("2020" = 1, "2015" = 0.5, "2010" = 0.3)) + | |
scale_color_manual(values = c("2020" = "black", "2015" = "gray60", | |
"2010" = "gray80")) + | |
scale_y_continuous(limits = c(0, NA), | |
labels = scales::label_percent(scale = 1)) + | |
scale_x_discrete(labels = c("Ärmste\n20%", "", "", "", "Reichste\n20%")) + | |
labs(x = "Einkommensquintile", y = NULL, | |
title = "Mehrwertsteuer belastet kleine Einkommen stärker", | |
subtitle = "Abgeführte Mehrwertsteuer als Anteil des Bruttoeinkommens <span style='color:gray80;'>2010</span>, <span style='color:gray60;'>2015</span>, 2020", | |
caption = "Daten: Eurostat, experimentelle Statistik. Grafik: @matschnetzer") + | |
theme_minimal(base_family = "Barlow Condensed") + | |
theme(legend.position = "none", | |
legend.direction = "horizontal", | |
panel.spacing.x = unit(1.5, unit="lines"), | |
axis.title.x = element_text(margin = margin(t = 1, unit = "lines")), | |
strip.text = element_blank(), | |
plot.title.position = "plot", | |
plot.title = element_text(size = 19), | |
plot.subtitle = element_markdown(size = 14, | |
margin = margin(b = 1, unit = "lines")), | |
plot.caption = element_text(size = 9), | |
panel.grid.minor = element_blank(), | |
panel.grid.major.x = element_blank()) | |
ggsave("vat_quintiles.png", width = 9, height = 6, dpi = 320, bg = "white") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment