且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

向VisNetwork Igraph添加颜色和悬停选项

更新时间:2023-12-06 13:25:16

以下内容会产生所需的结果:

The following yields the desired result:

# ...
i96e <- set.vertex.attribute(i96e, name = "group",value = col)
i96e = graph.adjacency(g96e, mode = "undirected", weighted = TRUE, diag=FALSE)
i96e <- set.vertex.attribute(i96e, name = "group",value = col)

V(i96e)$title <- V(i96e)$name
visIgraph(i96e, idToLabel = F, layout = "layout_nicely") %>% 
  visOptions_custom(highlightNearest = TRUE, selectedBy = "group")