如何为Shapefile中的多边形设置与填充色一致的边框颜色?
解决方法
要让多边形边框颜色与填充颜色一致,只需将color参数放入aes()中,映射和fill相同的变量(此处为NAME_2)即可:
library(terra) library(ggplot2) v <- vect(system.file("ex/lux.shp", package = "terra")) ggplot(v) + geom_spatvector(aes(fill = NAME_2, color = NAME_2))
这样每个多边形的边框会自动匹配其填充颜色,无需使用color = NA。
内容的提问来源于stack exchange,提问作者Tpellirn
相关产品推荐
相关产品推荐

