以下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))