Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # install dev version of ggplot2
- devtools::dev_mode()
- devtools::install_github("tidyverse/ggplot2")
- library(tidyverse)
- library(sf)
- library(rmapshaper)
- library(ggthemes)
- # load data
- source(file = url("https://gist.githubusercontent.com/ikashnitsky/4b92f6b9f4bcbd8b2190fb0796fd1ec0/raw/1e281b7bb8ec74c9c9989fe50a87b6021ddbad03/minimal-data.R"))
- # test how good they fit together
- ggplot() +
- geom_sf(data = REG, color = "black", size = .2, fill = NA) +
- geom_sf(data = NEI, color = "red", size = .2, fill = NA)+
- coord_sf(datum = NA)+
- theme_map()
- ggsave("test-1.pdf", width = 12, height = 10)
- # simplify
- REGs <- REG %>% ms_simplify(keep = .5, keep_shapes = TRUE)
- NEIs <- NEI %>% ms_simplify(keep = .5, keep_shapes = TRUE)
- ggplot() +
- geom_sf(data = REGs, color = "black", size = .2, fill = NA) +
- geom_sf(data = NEIs, color = "red", size = .2, fill = NA)+
- coord_sf(datum = NA)+
- theme_map()
- ggsave("test-2.pdf", width = 12, height = 10)
Add Comment
Please, Sign In to add comment