Created
April 7, 2023 09:28
-
-
Save mschnetzer/31651887cfead893643e377a4a83c516 to your computer and use it in GitHub Desktop.
Geschlechtsspezifische Unterschiede bei den Gründen für Teilzeit (https://twitter.com/matschnetzer/status/1625529059722641411)
This file contains hidden or 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(waffle) | |
library(msthemes) | |
library(viridis) | |
library(haven) | |
library(MetBrewer) | |
mz <- read_dta("mz2019.dta") | |
mz |> select(gewjahr, bsex, dteil) |> | |
filter(dteil > 0) -> mz | |
mzaz <- mz |> | |
mutate(dteil = fct_recode(as.factor(dteil), | |
"Betreuung/Pflege" = "1", | |
"Keine Vollzeit gewünscht" = "2", | |
"Andere persönliche Gründe" = "3", | |
"Keine Vollzeit gefunden" = "4", | |
"Aus-/Fortbildung" = "5", | |
"Krankheit" = "6", | |
"Sonstige Gründe" = "7")) |> | |
mutate(bsex = fct_recode(as.factor(bsex), | |
"Männer" = "1", | |
"Frauen" = "2")) |> | |
group_by(bsex, dteil) |> | |
summarise(tsum = sum(gewjahr)) |> | |
mutate(proz = tsum/sum(tsum)*100, | |
freq = round(proz, 0)) |> | |
mutate(freq = case_when( | |
bsex == "Frauen" & dteil == "Sonstige Gründe" ~ freq - 1, | |
TRUE ~ freq | |
)) | |
ggplot(mzaz, aes(fill=dteil, values=freq)) + | |
geom_waffle(color = "white", size=0.9, n_rows = 5) + | |
facet_wrap(~bsex, ncol=1) + | |
scale_x_discrete(expand=c(0,0)) + | |
scale_y_discrete(expand=c(0,0)) + | |
scale_fill_manual(values = met.brewer("Austria")) + | |
theme_ms(grid=F) + | |
theme(strip.text.x=element_text(size=14,margin=margin(b=5, t=5),family="Futura"), | |
plot.caption = element_text(margin=margin(t=4),family="Futura"), | |
plot.title = element_text(margin=margin(b=6)), | |
legend.title=element_blank(), | |
legend.position = "bottom", | |
legend.spacing = unit(3,"pt"), | |
legend.key.size=unit(0.6,"line"), | |
legend.text = element_text(size=8, family="Futura")) + | |
coord_equal() + | |
labs(title = "Gründe für Teilzeitarbeit", | |
caption="Daten: Mikrozensus 2019 Grafik: @matschnetzer") + | |
theme_enhance_waffle() | |
ggsave("parttime.png", dpi=320, width=6, height=4.5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment