Question

It is very straight-forward to plot a tree using igraph in R

library(igraph)
plot(graph.tree(20, 2), layout=layout.reingold.tilford)

Is it possible to "turn the graph around", so that the root (node 0) is at the top of the plot? Or, alternatively, is it possible to put the root to middle left?

Was it helpful?

Solution

The easiest way I know of is like this:

plot(graph.tree(20, 2), layout=layout.reingold.tilford, ylim=c(1,-1))

I don't know whether that's officially supported though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top