当我使用时,visLayout(hierarchical = TRUE)
我得到以下图片,我认为这是错误的:
随着visLayout(hierarchical = FALSE)
我得到(正确的)图片:
这是一个错误还是我错过了什么?可重现的例子:
nodes <- structure(list(id = 1:4, label = c("node1", "node2", "node3", "node4"),
value = c(0.3, 0.3, 0.3, 0.3),
title = c("node1", "node2", "node3", "node4")),
.Names = c("id", "label", "value", "title"),
row.names = c(NA, -4L),
class = "data.frame")
edges <- structure(list(from = 1:4,
to = c(2L, 3L, 4L, 1L),
arrows = c("to", "to", "to", "to")),
.Names = c("from", "to", "arrows"),
row.names = c(NA, -4L),
class = "data.frame")
visNetwork(nodes, edges, height = "100%", width = "100%") %>%
visOptions(highlightNearest = TRUE) %>%
visLayout(hierarchical = TRUE) %>%
visInteraction(navigationButtons = TRUE)
visNetwork(nodes, edges, height = "100%", width = "100%") %>%
visOptions(highlightNearest = TRUE) %>%
visInteraction(navigationButtons = TRUE)