Karsten W.
Karsten W.

Reputation: 18440

How can I draw a tree with igraph "bottom-up"?

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?

Upvotes: 1

Views: 2183

Answers (1)

Ken Williams
Ken Williams

Reputation: 23985

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.

Upvotes: 2

Related Questions