Skip to content

Instantly share code, notes, and snippets.

@mschnetzer
Last active January 29, 2020 09:32
Show Gist options
  • Save mschnetzer/7ebfa9b0f07ee4a93b6e56783481e249 to your computer and use it in GitHub Desktop.
Save mschnetzer/7ebfa9b0f07ee4a93b6e56783481e249 to your computer and use it in GitHub Desktop.
Öko-Steuern in Österreich 1995-2018 (https://twitter.com/matschnetzer/status/1222421619353612290)
library(tidyverse)
library(msthemes)
library(readxl)
library(patchwork)
library(eurostat)
# Download data from http://statistik.at/web_de/statistiken/wirtschaft/oeffentliche_finanzen_und_steuern/steuerstatistiken/oeko-steuern/index.html
data <- read_xlsx("oeko-steuern_1995_bis_2018.xlsx",skip = 1, n_max = 5) %>% filter(!is.na(`1995`))
taxdat <- data %>% gather(year, tax, 2:25) %>% mutate_at(vars(tax), ~./1000)
# Load EUROSTAT data
eutax <- get_eurostat(id = "t2020_rt320", filters = list(unit = "PC_TSCO_X_ISCO"), time_format = "num")
p1 <- ggplot(taxdat, aes(x = year, y = tax, fill=`Öko-Steuern`)) +
geom_bar(stat='identity', position= position_stack(reverse = T)) +
theme_ms() +
scale_fill_mssea() +
scale_x_discrete(breaks = seq(1995,2018,5)) +
theme(panel.grid.major.x = element_blank()) +
labs(x = "", y = "Mrd. Euro")
p2 <- ggplot(taxdat, aes(x = year, y = tax, fill=`Öko-Steuern`)) +
geom_bar(stat='identity', position= position_fill(reverse = T)) +
theme_ms() +
scale_fill_mssea() +
scale_y_continuous(labels = scales::percent(seq(0,1,0.25))) +
scale_x_discrete(breaks = seq(1995,2018,5)) +
theme(panel.grid.major.x = element_blank()) +
labs(x = "", y = "")
p3 <- eutax %>% filter(time == 2018, !geo == "EA19") %>%
ggplot(aes(x = reorder(geo, desc(values)), y = values,
color = geo %in% c("EU28", "AT"))) +
geom_linerange(aes(ymin = 0, ymax = values),color="azure2", size=2) +
geom_point(color="azure2", size=5) +
geom_point(size=4) +
scale_color_manual(guide=F, values = msc_palette[c(4,1)]) +
theme_ms() +
theme(panel.grid.major.x = element_blank()) +
labs(x = "", y = "% der Steuereinnahmen 2018")
finplot <- ((p1 | p2 ) + plot_layout(guides = "collect")) / p3 +
plot_annotation(title = "Der Umwelt zuliebe...?",
subtitle = "Einnahmen aus Öko-Steuern 1995-2018",
caption = "Daten: Statistik Austria, EUROSTAT. Grafik: @matschnetzer",
theme = theme_ms(dark=T)) &
theme(legend.position = "bottom",
legend.key.size = unit(0.5,"cm"),
legend.title = element_blank(),
legend.text = element_text(size = 9, color = "white"),
axis.title = element_text(size = 9, color = "white"),
axis.text = element_text(size = 7, color = "white"),
plot.title = element_text(size = 20, margin = margin(b=1.5)),
plot.subtitle = element_text(size = 14, margin = margin(t=1.5, b=10)))
ggsave(finplot, filename = "ecotax.png",
dpi=600, width = 9, height = 7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment