You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何为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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.24 18:32:33