ChriiSchee
ChriiSchee

Reputation: 709

How to set fix node positions with ggnet2

I am using ggnet2 to visualize networks and I was wondering whether anyone is aware of a way to fix the node positions as it is possible with e.g. igraph (as explained e.g. here How to control the igraph plot layout with Fixed Positions?)

Thanks, Chris

Upvotes: 0

Views: 872

Answers (2)

Richard Heal
Richard Heal

Reputation: 61

Ok, this is an old question but in case anyone looks for the answer...

Make a matrix of the coordinates:

l = as.matrix(data.frame(x = c(0.1,0.1, 0.5, 0.8), y = c(0.75, 0.25, 0.5, 0.5)))

Use

ggnet2(net, mode = l)

Upvotes: 2

falseAzure
falseAzure

Reputation: 41

I had the same problem myself and fixed it by setting the random seed. Apparently ggnet2 randomly distributes the nodes in line with the selected algorithm-mode. So to get reproducible that is to say identical plots just always use set.seed() before every plot.

e.g.:

set.seed(1)
ggnet2(net)

Upvotes: 2

Related Questions