我只想按子区域组的外部边界制作地图。在贝娄中绘制了所有子区域,我只想绘制一个地图,但只绘制对象region
列中区域的外部边界spain
。我曾与一些试图aes
像fill
和group
甚至分组通过绘制过,但无法找到一个妥善的办法:
library(rnaturalearth)
library(tidyverse)
spain <- ne_states(country = "spain", returnclass = "sf")
spain %>%
ggplot() +
geom_sf()
由reprex软件包(v0.2.1)创建于2019-02-12
为了澄清区域,在上面的地图中是一组打印的形状:
spain %>%
ggplot(aes(fill = region)) +
geom_sf() +
theme(legend.position = "none")
由reprex软件包(v0.2.1)创建于2019-02-12
两者group_by
并st_union
为选项:
spain %>%
group_by(region) %>%
summarise() %>%
ggplot(aes(fill = region)) +
geom_sf() +
theme(legend.position = 'none')
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句