创建边缘标签不重叠的 visNetwork 图

Ser*_*giy 5 visualization r visnetwork

有没有办法制作一个有向 visNetwork 图表,其中边的标签不重叠?(下图中的 e5 和 e4 重叠)

library(visNetwork)
nodes = data.frame(id = c(0, 1, 2, 3, 4),
                   X = c("x0", "x1", "x2", "x3", "x4"),
                   label = c("x0", "x1", "x2", "x3", "x4"),
                   shape = "circle")
edges = data.frame(from = c(0, 0, 1, 1, 2, 2),
                   to = c(1, 2, 3, 4, 3, 4),
                   arrows = "to",
                   label = c("e1", "e2", "e3", "e4", "e5", "e6"))

graph = visNetwork(nodes, edges)
visHierarchicalLayout(graph, 
                      levelSeparation = 150, 
                      sortMethod = "directed", 
                      direction = "LR")
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述