Skip to content

Instantly share code, notes, and snippets.

@jonspring
Created July 5, 2022 08:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonspring/49c1749c6d4f860ba5e8c097460859e6 to your computer and use it in GitHub Desktop.
Save jonspring/49c1749c6d4f860ba5e8c097460859e6 to your computer and use it in GitHub Desktop.
library(tidyverse)
permits <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2022/2022-07-05/sf_permits.csv')
permits2 <- permits %>%
mutate(lon = stringr::word(location, 2) %>% parse_number,
lat = stringr::word(location, 3) %>% parse_number) %>%
mutate(use = fct_lump(proposed_use, 7) %>% fct_explicit_na())
library(ggmap)
sf_basemap = get_map(location = c(lon = -122.45, lat = 37.75),
zoom = 12, maptype = 'terrain-background', source = 'stamen')
ggmap(sf_basemap) +
geom_point(data = permits2, aes(lon, lat, color = use),
size = 0.2, alpha = 0.5) +
ggthemes::scale_color_tableau() +
guides(color = guide_legend(override.aes = list(size = 3, alpha = 0.8))) +
theme_void() +
coord_map(projection = "mercator",
xlim=c(-122.52, -122.355),
ylim=c(37.705, 37.83))
ggsave("SF_map_uses.png", width = 10, height = 10, bg = "white")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment