Regular Graph Plot Works, Interactive Shows up Blank

谁说我不能喝 提交于 2021-01-05 08:53:14

问题


I am able to produce a regular plot just fine, but for some reason when I pass it through an interactive plotting function - there is a blank output.

Does anyone know what I am doing wrong?

library(igraph)
library(visNetwork)

#create relationships
data_a <-data.frame(
     
     "source" = c("123","124","123","125","123"),
     "target" = c("126", "123", "125", "122", "111"))
 
 #create edges
 Nodes <-data.frame(
     
     "source" = c("123","124","125","122","111", "126"),
     
     "Country" = c("usa", "uk", "uk", "usa", "uk", "usa"))

#create graph
 graph_file <- data.frame(data_a$source, data_a$target)
 graph <- graph.data.frame(graph_file, directed=F)
 graph <- simplify(graph)
plot(graph)

#clustering
fc <- cluster_fast_greedy(graph)
contracted <- simplify(contract(graph,membership(fc)))

#plot works
plot(contracted)

#does not work
visIgraph(contracted)  %>% visOptions (highlightNearest = TRUE)

来源:https://stackoverflow.com/questions/64949576/regular-graph-plot-works-interactive-shows-up-blank

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!