I have a problem with VisNetwork. I created a graph in R and each time when I click on the node and move it to other place, it comes back to where it was before. Is there any possibility to rearrange network manually? I'd like to move some nodes to the other place or to change the length of edges between some nodes, so that it would be more transparent.
Asked
Active
Viewed 1,934 times
2
-
1Use library d3Network to avoid issues – Arun kumar mahesh Jul 08 '16 at 11:43
-
Hi @Arunkumarmahesh is it possible to achieve something like [this](https://stackoverflow.com/questions/65583493/vis-network-define-node-location) in d3Network ? – user5249203 Jan 05 '21 at 17:37
1 Answers
1
At least two possibilities :
Use vis.js
to compute coordinate (default) and then after disable physics
require(visNetwork)
nodes <- data.frame(id = 1:3)
edges <- data.frame(from = c(1,2), to = c(1,3))
visNetwork(nodes, edges) %>%
visEvents(stabilizationIterationsDone="function () {this.setOptions( { physics: false } );}")
Or Use igraph
to compute coordinate. It's faster, and physics is disabled automatically
visNetwork(nodes, edges) %>% visIgraphLayout()
You can also set coordinate before render with x
& y
columns in nodes

bthieurmel
- 524
- 2
- 3
-
5Can you explain how to manually set the coordinates? I've created `x` and `y` values in `nodes` but it does not seem to follow them at all. – vashts85 Jul 14 '17 at 21:08
-
3Can you add an example on how to achieve it? Would be super useful! :) – DaveTheAl Apr 05 '20 at 12:32
-
is it possible to achieve something like [this](https://stackoverflow.com/questions/65583493/vis-network-define-node-location) with igraph ?appreciate if you can provide an example – user5249203 Jan 05 '21 at 17:38
-