在R,igraph的网络图中添加工具提示和图例

我正在使用iGraph构建一些网络图,但是在添加图例和工具提示时遇到了麻烦。

我在下面包括了repro代码,该代码可以成功地建立网络,但是还没有找到执行以下操作的正确方法:

1:显示标签的工具提示(test_net $ from_industry)。

  • 我使用工具提示是因为在实际的网络中,有太多的节点无法显示标签而没有视觉上的重叠。

2:图例显示了节点到test_net $ from_industry的颜色映射


library(igraph)
library(tidyverse)

test_net <- data.frame( 
  to = c(13,13,13),from = c(26,33,47,85,86,91),id = c(0,1,2,3,4,5),to_industry = c("Water","Steam,air-conditioning","Irrigation systems","Sporting goods","Hobby & toy stores","Religious organizations"),from_industry = c("Test1","Test2","Test3","Test4","Test5","Test6"),value = c(23,23,21,19,20)
)

test_network <- graph_from_data_frame(d=test_net,directed=F) 
plot(test_network,vertex.size=test_net$value*.5,vertex.color=test_network$from_industry,vertex.label=" ",layout=layout.random,main="Random")

任何有关如何最好地做到这一点的建议都是很好的。预先感谢。

current output without legends / overlay labels

xiaoyandexinsi 回答:在R,igraph的网络图中添加工具提示和图例

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3162597.html

大家都在问