0
我需要在地图上制作一个网络,并带有适当的地理参考。在地图上使用R中的geomnet
我试图让这样的事情: https://cran.r-project.org/web/packages/ggCompNet/vignettes/examples-from-paper.html
(看下方地图) 这是tripnet的头:
from_id to_id q_trx long lat
9 20020101 0 241 -58.41441 -34.60768
10 20020102 20040108 537 -58.41950 -34.60722
11 20020102 0 561 -58.41950 -34.60722
12 20020103 20040108 543 -58.42359 -34.60714
13 20020103 0 551 -58.42359 -34.60714
14 20020104 20040108 490 -58.42688 -34.60397
这里是我的代码:
map <- get_map(location = c("long" = -58.416212, "lat" = -34.631330), zoom = 12)
ggmap(map) + geom_net(
data = tripnet,
labelon = TRUE,
selfloops = TRUE,
vjust = -0.5,
ealpha = 0.5,
aes(
from_id = from_id,
to_id = to_id,
x = long ,
y = lat,
linewidth = q_trx,
colour = 'grey'
)
) +
scale_colour_manual("CABA", values = c("grey40")) + theme_net() %+replace% theme(aspect.ratio =
NULL, legend.position = "bottom") + coord_map()
显然没有错误,但它只是绘制一张没有网络的地图。