如何显示网络人员的住处以及他们之间的联系方式

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

我想展示网络人的住所及其联系方式。首先,我绘制了15个自治市的地图(基于ggplot2的SpatialPolygonsDataFrame,geom_polygon)。其次,我将网络人员放置在多边形的质心周围。在Markus Konrad撰写的“在地图上可视化图形的三种方式”中的第三个变体之后,到目前为止,我已经创建了两层https://datascience.blog.wzb.eu/2018/05/ 31 /在地图上可视化图形的三种方式/ )。作为mapcoords,我使用coord_fixed(比率= 1/1)。为了获得良好的结果,我不得不在annotation_custom中进行手动调整。我的问题:首先,是否有一种无需人工干预就能使各层相互适应的方法?其次,是否有更简单的解决方案来对网络人员及其连接进行地理位置定位?my result so far

  maptheme <- theme(panel.grid = element_blank()) +
  theme(axis.text = element_blank()) +
  theme(axis.ticks = element_blank()) +
  theme(axis.title = element_blank()) +
  theme(legend.position = "bottom") +
  theme(panel.grid = element_blank()) +
  theme(panel.background = element_rect(fill = "#596673")) +
  theme(plot.margin = unit(c(0, 0, 0.5, 0), 'cm'))

mapcoords <- coord_fixed(ratio=1/1)

theme_transp_overlay <- theme(
  panel.background = element_rect(fill = "transparent", color = NA),
  plot.background = element_rect(fill = "transparent", color = NA))

ArlMap <- ggplot(ARLmap.data, aes(long, lat)) +  
  geom_polygon(aes(group=group), colour='white', fill='grey')+
  theme(axis.text=element_blank())+
  theme(axis.ticks=element_blank())+
  theme(axis.title=element_blank())+
  mapcoords + maptheme


nodes <- ggplot(nwdata) +
  geom_point(aes(x = xkor, y = ykor, size = Btw),
             shape = 21, fill = "white", color = "black",    # draw nodes
             stroke = 0.5) +
  scale_size_continuous(guide = FALSE, range = c(1, 6)) +
    mapcoords + maptheme + theme_transp_overlay

ArlMap +
  annotation_custom(ggplotGrob(nodes), xmin = min(ARLmap.data$long)+900, xmax = max(ARLmap.data$long)-1200, ymin = min(ARLmap.data$lat)+1500, ymax = max(ARLmap.data$lat)) 
...
ggplot2 mapping igraph
1个回答
0
投票

我是目标。通过始终从地理方法入手,我得出了该解决方案:1.网络的节点接收lon / lat坐标。这些被确定为围绕地理单位质心的旋转坐标。 2.根据lon / lat坐标,为节点之间的连接提供新的起点和终点。 3.该图仅限于基本功能图,线和点。enter image description here

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