首页 > 解决方案 > 常规图表有效,交互式显示空白

问题描述

我能够很好地生成常规图,但是由于某种原因,当我通过交互式绘图功能传递它时 - 有一个空白输出。

有谁知道我做错了什么?

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)

标签: rplotgraphdata-visualizationinteractive

解决方案


推荐阅读