Skip to content

Instantly share code, notes, and snippets.

@gtm19
Created June 23, 2020 13:21
Show Gist options
  • Save gtm19/4c270ab303460ca8641517ee7db240a0 to your computer and use it in GitHub Desktop.
Save gtm19/4c270ab303460ca8641517ee7db240a0 to your computer and use it in GitHub Desktop.
library(tidyverse)
library(googlesheets4)
library(sf)
us <-
rnaturalearth::ne_states(returnclass = "sf") %>%
filter(iso_a2 == "US" & !iso_3166_2 %in% c("US-HI", "US-AK")) %>%
sf::st_transform(102003)
monuments <-
googlesheets4::read_sheet(
"https://docs.google.com/spreadsheets/d/17ps4aqRyaIfpu7KdGsy2HRZaaQiXUfLrpUbaR9yS51E/edit#gid=400111512",
sheet = 2
) %>%
janitor::clean_names() %>%
separate(coordinates, into = c("lat", "lon"), sep = ", ", convert = TRUE) %>%
filter_at(vars(lon, lat), all_vars(!is.na(.))) %>%
st_as_sf(coords = c("lon", "lat"), crs = 4326) %>%
filter(state != "AK") %>%
sf::st_transform(102003)
us %>%
ggplot() +
geom_sf(data = st_set_crs(us$geometry + c(75000, -85000), 102003),
fill = "#1a535c",
colour = "#1a535c") +
geom_sf(fill = "#ff6b6b", colour = "#FF5C5C") +
geom_sf(data = filter(monuments, symbol_type == "Monument"),
aes(colour = was_this_symbol_removed),
size = 2,
pch = 1
) +
geom_sf(data = filter(monuments, symbol_type == "Monument"),
aes(colour = was_this_symbol_removed),
size = 0.8
) +
labs(title = "The Confederacy Legacy",
subtitle = "The location of monuments in the Contiguous\nUnited States, built in honour of\nthe Confederate States",
colour = "Status",
caption = paste0("Source: Southern Poverty Law Center:\nhttps://www.splcenter.org/data-projects/whose-heritage\nCreated by @gathmad on ", format(Sys.Date(), "%d %B %Y"))) +
theme_void(base_family = "Fira Code", base_size = 16) +
scale_color_manual(values = c("#ffe66d", "#4ecdc4")) +
theme(plot.background = element_rect(fill = "#f7fff7", colour = "transparent"),
panel.background = element_rect(fill = "#f7fff7", colour = "transparent"),
text = element_text(colour = "#1a535c"), plot.caption = element_text(size = 8),
plot.title = element_text(hjust = 0.5),
plot.subtitle = element_text(hjust = 0.5, size = 12),
plot.margin = unit(c(1,1,0.5,1), "cm"),
legend.position = "bottom",
legend.margin = margin(0.5,0.5,0.5,0.5, "cm"))
ggsave("confederate_statues.png", dpi = 600, width = 10, height = 10, bg = "#f7fff7")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment