相关疑难解决方法(0)

如何将geom_sf生成的地图放在ggmap生成的栅格之上

我尝试了以下代码:

library(ggplot2)
library(ggmap)
library(sf)
nc <- st_read(system.file("shape/nc.shp", package = "sf"))
str(nc)

 Classes ‘sf’ and 'data.frame':  100 obs. of  15 variables:
 $ AREA     : num  0.114 0.061 0.143 0.07 0.153 0.097 0.062 0.091 0.118 0.124 ...
 $ PERIMETER: num  1.44 1.23 1.63 2.97 2.21 ...
 $ CNTY_    : num  1825 1827 1828 1831 1832 ...
 $ CNTY_ID  : num  1825 1827 1828 1831 1832 ...
 $ NAME     : Factor w/ 100 levels "Alamance","Alexander",..: 5 3 86 27 66 46 15 37 …
Run Code Online (Sandbox Code Playgroud)

maps r ggplot2 ggmap r-sf

14
推荐指数
2
解决办法
2835
查看次数

标签 统计

ggmap ×1

ggplot2 ×1

maps ×1

r ×1

r-sf ×1