Population choropleth with coastline

Code Example: geom_sf choropleth with coastline

 

This code example adds a coastline overlay ontop of a population choropleth of population. Census tracts extend over water and obscure the landform geography. A good coastline is a great find. See the GitHub Repo showing a full code treatment.

Date

2018-08-28

Example Code, Abbreviated

ggplot() +
  geom_sf(data = borroughs, aes(fill = pop)) +
  viridis::scale_fill_viridis(direction = -1) +
  geom_sf(data = coast, color = "black", fill = "black") +
  coord_sf(xlim = c(-73.7, -74.3), ylim = c(40.45, 40.95)) + 
  theme(panel.background = element_rect(fill = "transparent"), 
        panel.grid.major = element_line(color = "transparent"), 
        axis.text.x = element_blank(), 
        axis.text.y = element_blank(), 
        axis.ticks = element_blank())