Created
September 22, 2020 15:23
-
-
Save andrewheiss/3abbe58158a937f0d8069952f798e334 to your computer and use it in GitHub Desktop.
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
library(tidyverse) | |
library(tidygeocoder) | |
library(sf) | |
library(albersusa) | |
places <- tribble( | |
~name, ~address, | |
"My empty GSU office", "14 Marietta Street NW, Atlanta, GA 30303", | |
"My old BYU office", "155 East 1230 North, Provo, UT 84604", | |
"My old Duke office", "201 Science Dr, Durham, NC 27708" | |
) %>% | |
geocode(address, method = "census", lat = latitude, long = longitude) %>% | |
st_as_sf(coords = c("longitude", "latitude"), crs = 4326) | |
lower_48 <- usa_sf("longlat") %>% filter(!(iso_3166_2 %in% c("AK", "HI", "DC"))) | |
update_geom_defaults("label", list(family = "Asap Condensed SemiBold")) | |
ggplot() + | |
geom_sf(data = lower_48, size = 0.25, fill = "grey95") + | |
geom_sf(data = places, color = "#FF4136") + | |
geom_sf_label(data = places[1,], aes(label = name), nudge_y = -150000) + | |
geom_sf_label(data = places[2:3,], aes(label = name), nudge_y = 150000) + | |
coord_sf(crs = 5070) + # Albers | |
theme_void() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment