1

I'm making a network plot in R using iGraph. I first plot it using tkplot() so that I can manually reposition some of the nodes. Then I capture the new coordinates and then insert those in the plot function to replot the graph along with additional adjustments (changing the opacity of the nodes).

The problem is that even when using the tkplot.coords coordinates, the second graph doesn't look like the tkplot. Instead, some of the arrow heads appear in the middle of the edge rather than at the end, and the nodes are tightly clustered and overlapping, even though that isn't the case with the tkplot. Any suggestions for how I can get the plot() function to exactly mimic the plot produced using tkplot()?

I am using R Studio, so I am wondering if there is a conversion issue with that.

My simplified code is as follows:

    Net1 <- graph.data.frame(myedgedata, vertices=nodeslist, directed=TRUE)
    g <- graph.adjacency(get.adjacency(Net1), weighted = TRUE)
    E(g)$weight <- E(g)$weight+1
    tkplot(g)
    coords <- tkplot.getcoords(1)
    plot(g, edge.width=E(g)$weight, vertex.color = adjustcolor(nodeslist$colors, alpha=.5), layout=coords)
Net20
  • 105
  • 1
  • 5
  • A reproducible example would help. Can you add the output of `dput(Net1)` to your question? – mikeck May 21 '15 at 19:10
  • Unfortunately the data I'm using is sensitive, so I can't give the output dput(Net1). The output is formatted as follows though: structure(list(no of nodes, TRUE, c(numbers...), list(c(1, 0, 1), structure(list(), Names = character(0), structure(list(name = c(names of nodes...), attribute1 = c(values of attribute), colors = c(colors for each node)), .Names = c("node name", "attribute1", "colors")), list())), class = "igraph") – Net20 May 21 '15 at 19:52

0 Answers0