x
library(sf)
library(albersusa) # github.com/hrbrmstr/albersusa
library(hrbrthemes)
library(tidyverse)
jsonlite::stream_in(
url(
readLines(
"https://hrbrmstr.github.io/capitol-breach-scraper-and-data/latest.txt"
)
),
verbose = FALSE
) |>
dplyr::glimpse() -> xdf
states <- usa_sf()
st_crs(states) <- st_crs(states)
states %>%
left_join(
xdf %>%
count(state),
c("name"="state")
) -> states
st_centroid(
st_make_valid(states)
) -> ppl
ggplot() +
geom_sf(data = states, size = 0.125) +
geom_sf(data = ppl, aes(size = n), color = "#D8281B") +
scale_x_continuous(expand = c(0,0)) +
scale_y_continuous(expand = c(0,0)) +
coord_sf(crs = us_laea_proj, datum = NA) +
labs(
x = NULL, y = NULL, color = "# Defendants", size = "# Defendants",
title = "Where The January 6th, 2021 Capitol Insurrectionists Are From",
subtitle = "The Department of Justice maintains an updated list of defendants charged in the Capitol breach which includes their state of residence.",
caption = "Source: hrbrmstr's scraper: <https://github.com/hrbrmstr/capitol-breach-scraper-and-data>\n#30DayMapChallenge 2021"
) +
theme_ipsum_gs(grid="") +
theme(legend.position = c(0.825, 0.1)) +
theme(legend.direction = "horizontal") +
theme(legend.justification = "right")