Trump's Strongest Supporters
cces19 %>% | |
cces_trad(religpew) %>% | |
filter(CC19_334c == 7) %>% | |
filter(CC19_334a == 7) %>% | |
filter(CC19_308a == 1) %>% | |
ct(trad, show_na = FALSE) | |
gg1 <- cces19 %>% | |
filter(CC19_334c <= 7) %>% | |
ct(CC19_334c, wt = commonweight) %>% | |
rename(id = CC19_334c) %>% | |
mutate(group = "Donald Trump") | |
gg2 <- cces19 %>% | |
filter(CC19_334a <= 7) %>% | |
ct(CC19_334a, wt = commonweight) %>% | |
rename(id = CC19_334a) %>% | |
mutate(group = "Yourself") | |
graph <- bind_rows(gg1, gg2) %>% | |
mutate(id = frcode(id == 1 ~ "Very\nLiberal", | |
id == 2 ~ "Liberal", | |
id == 3 ~ "Somewhat\nLiberal", | |
id == 4 ~ "Middle of\nthe Road", | |
id == 5 ~ "Somewhat\nConservative", | |
id == 6 ~ "Conservative", | |
id == 7 ~ "Very\nConservative")) | |
graph %>% | |
ggplot(., aes(x = 1, y = pct, fill = fct_rev(id))) + | |
geom_col(color = "black") + | |
coord_flip() + | |
facet_wrap(~ group, ncol =1, strip.position = "left") + | |
scale_fill_manual(values = c("#8D021F", "#B2182B","#EF8A62","azure4", "#67A9CF", "#2166AC", "#000080", "darkorchid")) + | |
theme_rb() + | |
theme(legend.position = "bottom") + | |
scale_y_continuous(labels = percent) + | |
theme(strip.text.y.left = element_text(angle = 0)) + | |
guides(fill = guide_legend(reverse=T, nrow = 1)) + | |
theme(axis.title.y=element_blank(), axis.text.y=element_blank(), axis.ticks.y=element_blank()) + | |
theme(panel.grid.minor.y=element_blank(), panel.grid.major.y=element_blank()) + | |
geom_text(aes(label = ifelse(pct >.05, paste0(pct*100, '%'), '')), position = position_stack(vjust = 0.5), size = 4, family = "font", color = "white") + | |
labs(x = "", y = "", title = "Place Each on the Ideological Scale", subtitle = "", caption = "") + | |
ggsave("E://ideo_dist.png", width = 9, height = 3) | |
ttt1 <- cces19 %>% | |
mutate(trad2 = frcode(evangelical == 1 ~ "Evangelical", | |
mainline == 1 ~ "Mainline", | |
catholic == 1 ~ "Catholic", | |
religpew == 11 ~ "Nothing in\nParticular", | |
TRUE ~ "Something Else")) %>% | |
filter(CC19_334c == 7) %>% | |
filter(CC19_334a == 7) %>% | |
filter(CC19_308a == 1) %>% | |
ct(trad2, show_na = FALSE) %>% | |
mutate(group = "Trump's Strongest Supporters") | |
ttt2 <- cces19 %>% | |
mutate(trad2 = frcode(evangelical == 1 ~ "Evangelical", | |
mainline == 1 ~ "Mainline", | |
catholic == 1 ~ "Catholic", | |
religpew == 11 ~ "Nothing in\nParticular", | |
TRUE ~ "Something Else")) %>% | |
# filter(CC19_334c == 7) %>% | |
# filter(CC19_334a == 7) %>% | |
# filter(CC19_308a == 1) %>% | |
ct(trad2, show_na = FALSE) %>% | |
mutate(group = "Entire Population") | |
graph <- bind_rows(ttt1, ttt2) | |
graph %>% | |
ggplot(., aes(x = trad2, y = pct, fill = group)) + | |
geom_col(color = "black", position = "dodge") + | |
y_pct() + | |
theme_rb(legend = TRUE) + | |
scale_fill_manual(values = c("azure3", "firebrick3")) + | |
lab_bar(top = TRUE, pos = .02, sz = 4, type = pct) + | |
labs(x = "", y = "", title = "Religious Breakdown of Trump's Base", caption = "@ryanburge\nData: CCES 2019") + | |
ggsave("E://trump_strong_support_trad.png", type = "cairo-png", width = 6) | |
ttt1 <- cces19 %>% | |
cces_attend(pew_churatd) %>% | |
filter(CC19_334c == 7) %>% | |
filter(CC19_334a == 7) %>% | |
filter(CC19_308a == 1) %>% | |
ct(att, show_na = FALSE) %>% | |
mutate(group = "Trump's Strongest Supporters") | |
ttt2 <- cces19 %>% | |
cces_attend(pew_churatd) %>% | |
# filter(CC19_334c == 7) %>% | |
# filter(CC19_334a == 7) %>% | |
# filter(CC19_308a == 1) %>% | |
ct(att, show_na = FALSE) %>% | |
mutate(group = "Entire Population") | |
graph <- bind_rows(ttt1, ttt2) | |
graph %>% | |
ggplot(., aes(x = 1, y = pct, fill = fct_rev(att))) + | |
geom_col(color = "black") + | |
coord_flip() + | |
facet_wrap(~ group, ncol =1, strip.position = "left") + | |
scale_fill_nejm() + | |
theme_rb() + | |
theme(legend.position = "bottom") + | |
scale_y_continuous(labels = percent) + | |
theme(strip.text.y.left = element_text(angle = 0)) + | |
guides(fill = guide_legend(reverse=T, nrow = 1)) + | |
theme(axis.title.y=element_blank(), axis.text.y=element_blank(), axis.ticks.y=element_blank()) + | |
theme(panel.grid.minor.y=element_blank(), panel.grid.major.y=element_blank()) + | |
geom_text(aes(label = ifelse(pct >.05, paste0(pct*100, '%'), '')), position = position_stack(vjust = 0.5), size = 4, family = "font", color = "white") + | |
labs(x = "", y = "", title = "Church Attendance of Each Group", subtitle = "", caption = "@ryanburge\nData: CCES 2019") + | |
ggsave("E://attend_strong_trump.png", width = 9, height = 3) | |
cces19 %>% | |
# filter(CC19_334c == 7) %>% | |
# filter(CC19_334a == 7) %>% | |
# filter(CC19_308a == 1) %>% | |
ct(faminc_new, show_na = FALSE, wt = commonweight) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment