Created
July 5, 2022 08:56
-
-
Save jonspring/49c1749c6d4f860ba5e8c097460859e6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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) | |
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