Skip to content

Instantly share code, notes, and snippets.

@gtgrthrst
Created May 16, 2021 12:47
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 gtgrthrst/1cd3cee11ca6434c4fe4b4bb603b839e to your computer and use it in GitHub Desktop.
Save gtgrthrst/1cd3cee11ca6434c4fe4b4bb603b839e to your computer and use it in GitHub Desktop.
library(sf)
library(ggplot2)
taiwan_shp <- st_read("C:\\Users\\gtgrt\\Downloads\\台灣鄉里界線\\TOWN_MOI_1091016.shp") #https://github.com/gtgrthrst/OpenData/blob/main/TOWN_MOI_1091016.shp
ggplot(taiwan_shp) +
geom_sf()
taiwan_shp %>% st_crop(xmin=118,xmax=123,ymin=20,ymax=26) %>%
ggplot() +
geom_sf(aes(colour = COUNTYNAME, fill = COUNTYNAME)) +
guides(fill = FALSE, color = FALSE, linetype = FALSE, shape = FALSE) #刪除圖例
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment