相关疑难解决方法(0)

使用 GADM shapefile 为美国地图绘制较粗的州边界和较细的县边界

我之前有一篇文章是关于使用GADM中的形状文件绘制美国地图,同时删除五大湖地区的颜色映射。根据@Majid 的建议解决了该问题。

现在,我进一步想要更厚的州边界和更薄的县边界。我首先绘制县级分区统计图,然后添加额外的未填充的州/国家级边界:

library(sf)
library(tidyverse)
library(RColorBrewer) #for some nice color palettes

# US map downloaded from https://gadm.org/download_country_v3.html

# National border
us0 <- st_read("<Path>\\gadm36_USA_0.shp")
# State border
us1 <- st_read("<Path>\\gadm36_USA_1.shp")
# County border
us2 <- st_read("<Path>\\gadm36_USA_2.shp")

# Remove the Great Lakes
# retrieving the name of lakes and excluding them from the sf 
all.names = us2$NAME_2
patterns = c("Lake", "lake")

lakes.name <- unique(grep(paste(patterns, collapse="|"), 
                     all.names, 
                     value=TRUE, ignore.case = TRUE))

# Pick the Great Lakes
lakes.name <- lakes.name[c(4, 5, …
Run Code Online (Sandbox Code Playgroud)

maps r ggplot2 r-maptools r-sf

1
推荐指数
1
解决办法
2280
查看次数

标签 统计

ggplot2 ×1

maps ×1

r ×1

r-maptools ×1

r-sf ×1