我想将节点的位置固定在 (1,0)、(0,1)、(-1,0)、(0,-1) 和 (0,0)。但是,它不起作用,我的 Java 知识为零(似乎,这是关于 Java 代码的问题)。
有人可以帮忙吗?这是一个例子:
require(visNetwork, quietly = TRUE)
nodes <- data.frame(id = 1:5)
# x = c(1, 0, -1, 0, 0),
# y = c(0, 1, 0, -1, 0))
edges <- data.frame(from = c(1,2), to = c(1,3))
visNetwork(nodes, edges, width = "100%") %>%
visNodes(x = c(1, 0, -1, 0, 0),
y = c(0, 1, 0, -1, 0), fixed = TRUE, physics = TRUE) %>%
visOptions(highlightNearest = TRUE) %>%
visInteraction(navigationButtons = TRUE, dragNodes = FALSE,
dragView = FALSE, zoomView = FALSE) %>%
visEdges(arrows = 'from')