我正在尝试使用collapse
参数折叠visNetwork图。但是,连接到隐藏节点的边不会正确塌陷并保持可见。查看最小示例:
library(visNetwork)
library(magrittr)
nodes <- data.frame(id = letters[1:7],
label = letters[1:7],
hidden = c(FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE),
x = c(1, rep(200, 3), rep(400, 3)),
y = c(rep(200, 2), 100, 300, 100, 300, 200))
edges <- data.frame(from = c('a', 'b', 'b', 'c', 'd', 'b'),
to = c('b', 'c', 'd', 'e', 'f', 'g'))
visNetwork(nodes, edges) %>%
visPhysics(enabled = FALSE) %>%
visNodes(shape = 'circle') %>%
visOptions(collapse = list(enabled = TRUE, keepCoord = TRUE))
双击节点b时,我希望所有传出的边都被隐藏,但是连接到隐藏节点c和d的那些边仍然可见。当前在visNetwork中这是不可能的,还是有解决此问题的方法?