使用geom_sf时如何删除边框线? [英] How can I remove border lines when using geom_sf?
本文介绍了使用geom_sf时如何删除边框线?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试执行以下操作:
ggplot(geography) + geom_sf(aes(fill=rate, color = NULL))
但这并没有消除边界线.
but that didn't get rid of the border lines.
推荐答案
没有可重复的示例,很难确切地知道您要查找的内容.但是,我会猜测您正在寻找一种方法来抑制标记不同多边形(区域)之间边界的线,例如,抑制在世界地图上显示国家边界的线.如果是这样,那么这里是一个解决方案.
Without a reproducible example it is difficult to know exactly what you are looking for. However, I will take a guess that your are looking for a way to suppress the lines marking boundaries between different polygons (regions), e.g., suppress the lines showing country borders on a map of the world. If that is so then here is a solution.
示例(您可能需要下载ggplot2
的开发版本)
Example (you might need to download the developmental version of 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")
这篇关于使用geom_sf时如何删除边框线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文