Reputation: 435
I´m trying to plot a Tree using igraph and started from very simple examples available on the web, one of them is
library(igraph)
el <- matrix( c("root", "y", "root", "x", "x", "a", "x", "b"), nc=2, byrow=TRUE)
g13 <- graph.edgelist(el)
co <- layout.reingold.tilford(g13, flip.y=TRUE)
plot(g13, layout=co)
The issue is I get all vertices on the same line, the root at left and the rest to right of it, as shown:
I tried other variations like
plot(g13, layout=layout.reingold.tilford)
and the results were the same.
What am I doing wrong?
Regards
Upvotes: 1
Views: 1906
Reputation: 57210
It seems necessary to specify the root node:
co <- layout.reingold.tilford(g13, params=list(root=1))
plot(g13, layout=co)
Upvotes: 3