函数geom_sf中ggplot2中的抖动坐标点

问题描述 投票:0回答:1

我有一个名为 DRCac 的坐标点数据框,如下所示:

日期 几何
1/21/22 点(-92.24382 36.25225)
1/22/22 点(-92.24302 36.25116)
1/23/22 点(-92.24382 36.25225)
1/21/22 点(-92.24302 36.25116)
1/22/22 点(-92.24382 36.25225)

有近四百个点,当使用此代码绘制时,它们在地图上重叠太多。它们覆盖的形状文件称为系统。

DRCmap <- ggplot() +
  geom_sf(data = System) +
  geom_sf(data = DRCac, aes(color = Species)) +
  coord_sf(ylim = c(36.246, 36.253), xlim = c(-92.241,-92.245), expand = FALSE)

有没有办法可以抖动函数 geom_sf() 内的点,或者我是否必须使用不同的函数。从透视角度来看,东方向就是图例所在的位置,因此抖动必须是纵向的。

r ggplot2 coordinates shapefile
1个回答
0
投票

Hadley 似乎很清楚,他认为这不属于

geom_sf()
通话。 https://github.com/tidyverse/ggplot2/issues/2332

但是,我刚刚有一个类似的用例,并使用了

sf::st_jitter()
https://r-spatial.github.io/sf/reference/st_jitter.html,效果非常好。

© www.soinside.com 2019 - 2024. All rights reserved.