问题
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