100% Pro-Life Abortion
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
gg <- gss %>% | |
mutate(prochoice = case_when(abdefect == 1 & | |
abrape == 1 & | |
abnomore == 1 & | |
abpoor == 1 & | |
abhlth == 1 & | |
absingle == 1 ~ 1, TRUE ~ 0)) %>% | |
mutate(pid2 = frcode(partyid == 0 | partyid == 1 | partyid == 2 ~ "Democrats", | |
partyid == 4 | partyid == 5 | partyid == 6 ~ "Republicans")) %>% | |
group_by(year, pid2) %>% | |
mean_ci(prochoice) %>% | |
mutate(group = "Completely Pro-Choice") | |
gg1 <- gss %>% | |
mutate(prolife = case_when(abdefect == 2 & | |
abrape == 2 & | |
abnomore == 2 & | |
abpoor == 2 & | |
abhlth == 2 & | |
absingle == 2 ~ 1, TRUE ~ 0)) %>% | |
mutate(pid2 = frcode(partyid == 0 | partyid == 1 | partyid == 2 ~ "Democrats", | |
partyid == 4 | partyid == 5 | partyid == 6 ~ "Republicans")) %>% | |
group_by(year, pid2) %>% | |
mean_ci(prolife) %>% | |
mutate(group = "Completely Pro-Life") | |
yy <- bind_rows(gg, gg1) | |
yy %>% | |
filter(pid2 != "NA") %>% | |
filter(mean > 0) %>% | |
ggplot(., aes(x = year, y = mean, color = group, group = group)) + | |
geom_point(size=3, color="white") + | |
geom_point(size=2, shape=1) + | |
geom_point(size=1, shape=19) + | |
geom_smooth(se = FALSE, linetype = "twodash") + | |
theme_gg("Abel") + | |
scale_color_tableau() + | |
theme(legend.position = "bottom") + | |
facet_wrap(~ pid2) + | |
scale_x_continuous(breaks = c(1978, 1988, 1998, 2008, 2018)) + | |
y_pct() + | |
labs(x = "", y = "", title = "Consistent Positions Abortion Over Time", caption = "@ryanburge\nData: GSS 1972-2018") + | |
ggsave("E://prolife_prochoice.png", type = "cairo-png") | |
life <- gss %>% | |
mutate(prolife = case_when(abdefect == 2 & | |
abrape == 2 & | |
abnomore == 2 & | |
abpoor == 2 & | |
abhlth == 2 & | |
absingle == 2 ~ 1, TRUE ~ 0)) %>% | |
mutate(reltrad = frcode(reltrad == 1 ~ "Evangelical", | |
reltrad == 2 ~ "Mainline", | |
reltrad == 3 ~ "Black Prot.", | |
reltrad == 4 ~ "Catholic", | |
reltrad == 5 ~ "Jewish", | |
reltrad == 6 ~ "Other Faith", | |
reltrad == 7 ~ "No Religion")) %>% | |
filter(year >= 2008 & prolife == 1) %>% | |
ct(reltrad, wt = wtssall, show_na = FALSE) %>% | |
mutate(group = "100% Pro-Life") | |
choice <- gss %>% | |
mutate(prolife = case_when(abdefect == 1 & | |
abrape == 1 & | |
abnomore == 1 & | |
abpoor == 1 & | |
abhlth == 1 & | |
absingle == 1 ~ 1, TRUE ~ 0)) %>% | |
mutate(reltrad = frcode(reltrad == 1 ~ "Evangelical", | |
reltrad == 2 ~ "Mainline", | |
reltrad == 3 ~ "Black Prot.", | |
reltrad == 4 ~ "Catholic", | |
reltrad == 5 ~ "Jewish", | |
reltrad == 6 ~ "Other Faith", | |
reltrad == 7 ~ "No Religion")) %>% | |
filter(year >= 2008 & prolife == 1) %>% | |
ct(reltrad, wt = wtssall, show_na = FALSE) %>% | |
mutate(group = "100% Pro-Choice") | |
gg <- bind_rows(life, choice) | |
gg %>% | |
ggplot(., aes(x=1, y = pct, fill = fct_rev(reltrad))) + | |
geom_col(color = "black") + | |
coord_flip() + | |
facet_wrap(~ group, ncol =1) + | |
theme_gg("Abel") + | |
theme(legend.position = "bottom") + | |
scale_fill_tableau() + | |
scale_y_continuous(labels = percent) + | |
guides(fill = guide_legend(reverse=T, nrow =1)) + | |
theme(axis.title.y=element_blank(), axis.text.y=element_blank(), axis.ticks.y=element_blank()) + | |
geom_text(aes(label = ifelse(pct >.05, paste0(pct*100, '%'), '')), position = position_stack(vjust = 0.5), size = 4, family = "font", color = "black") + | |
theme(panel.grid.major.y = element_blank()) + | |
theme(panel.grid.minor.y = element_blank()) + | |
theme(plot.title = element_text(size = 16)) + | |
labs(x = "", y = "", title = "The Religious Composition of Pro-Life and Pro-Choice", caption = "@ryanburge\nData: GSS 2008-2018") + | |
ggsave("E://ab_reltrad100.png", type = "cairo-png", height = 4, width = 8) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment