Created
July 25, 2022 17:34
-
-
Save ryanburge/004800ede20c67f61aa4dddcde64f7b1 to your computer and use it in GitHub Desktop.
Quick Map
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
## Figure 11.1 #### | |
era <- range_speedread("https://docs.google.com/spreadsheets/d/15Yjcs8tFDyvcqaWw9cPmFIKBuRwqLPnB17VsKhFccJA/edit?usp=sharing") | |
era <- era %>% mutate(ratified = as.factor(ratified)) | |
era <- era %>% | |
mutate(fill = frcode(ratified == "1972" ~ "1972", | |
ratified == "1973" ~ "1973", | |
ratified == "1974" | ratified == "1977" | ratified == "2017" | ratified == "2018" | ratified == "2020" ~ "1974 or Later", | |
TRUE ~ "Never Ratified/Rescinded")) | |
library(fiftystater) | |
data("fifty_states") | |
era$id <- tolower(era$state) | |
mapp <- left_join(fifty_states, era, by = c("id")) %>% as_tibble() %>% filter(fill != "NA") | |
mapp %>% | |
ggplot(., aes(map_id = id)) + | |
geom_map(aes(fill = fill), map = fifty_states, color = "black") + | |
expand_limits(x = fifty_states$long, y = fifty_states$lat) + | |
coord_map() + | |
scale_x_continuous(breaks = NULL) + | |
scale_y_continuous(breaks = NULL) + | |
labs(x = "", y = "") + | |
theme(legend.position = "bottom", | |
panel.background = element_blank()) + | |
fifty_states_inset_boxes() + | |
scale_fill_grey(start=0.8, end=0.2) + | |
theme_rb(legend = TRUE) + | |
labs(title = "ERA Ratification by States") + | |
save("Ch11/figure1.png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment