通过给出圆度因子使边缘在visNetwork中弯曲

时间:2018-01-08 12:51:52

标签: javascript r igraph vis.js visnetwork

以下R脚本创建了一个visNetwork图,如图所示。如何通过给出弯曲因子手动将直边改为弯曲边缘?

我在这里尝试使用圆度属性的一种方法,使用" smooth"标签。但是,无法实现它。

library(visNetwork)
nodes <- data.frame(id = 1:3,color = c(rep("blue",1), rep("red",1), 
rep("green",1)))
edges <- data.frame(from = c(1,2,3), to = c(2,3,1))
nodes = data.frame(nodes, level = edges$from)
visNetwork(nodes, edges, height = "500px", width = "100%") %>% 
visOptions(highlightNearest = list(enabled = T, degree = 2, hover = T)) %>%
visOptions(highlightNearest = F, nodesIdSelection = F, width = 500, height = 
500,autoResize = F) %>%
visHierarchicalLayout() %>% 
visEdges(shadow = TRUE,
       arrows =list(to = list(enabled = TRUE, scaleFactor = 2)),
       color = list(color = "black", highlight = "red"),
       smooth = list(roundness = 0.3)) 

Process Map Snapshot

0 个答案:

没有答案