I am trying to 1) get the coordinates of a network 2) use them for other networks to have always the same position of nodes.
When I get the coordinates of the nodes and set the coordinates to the same network from which I got them, it changes. The x position remains the same and the y position becomes symmetric to the hypothetical y axes. Thus, when applied twice, the position is the one that I want.
The problem is probably in the tkplot.getcoords() function. Do you know if there is a trick to avoid applying it twice?
n <- 20
mat <- matrix(1:n^2, n,n)
g <- graph.adjacency(mat, mode="directed", weighted=TRUE, diag=FALSE)
V(g)$color <- "white"
id <- tkplot(g, edge.curved = 0.5)
coor <- tkplot.getcoords(id,norm=F)
coor
tkplot.setcoords(id, coor) # wrong position
coor <- tkplot.getcoords(id,norm=F)
coor
tkplot.setcoords(id, coor) # desired position