我尝试执行以下操作:
ggplot(geography) + geom_sf(aes(fill=rate, color = NULL))
但这并没有摆脱边界线。
没有可复制的示例,很难确切地知道您要查找的内容。但是,我会猜测您正在寻找一种方法来抑制标记不同多边形(区域)之间的边界的线,例如,抑制在世界地图上显示国家边界的线。如果是这样,那么这里是一个解决方案。
lwd = 0
在geom_sf
通话中使用。示例(您可能需要下载的开发版本ggplot2
)
# devtools::install_github("tidyverse/ggplot2")
library(ggplot2)
library(maps)
library(maptools)
library(rgeos)
library(sf)
world1 <- sf::st_as_sf(map('world', plot = FALSE, fill = TRUE))
with_boundary <-
ggplot() +
geom_sf(data = world1, mapping = aes(fill = ID)) +
theme(legend.position = "none") +
ggtitle("With Country Boundaries")
without_boundary <-
ggplot() +
geom_sf(data = world1, mapping = aes(fill = ID), lwd = 0) +
theme(legend.position = "none") +
ggtitle("Without Country Boundaries")
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句