[R] ape -- internal nodes and pie charts

Albert Vilella avilella at gmail.com
Wed Oct 18 17:01:53 CEST 2006


I respond to myself.

Using:

show.node.label = TRUE

and looking at the doc for ?nodelabels:

data(bird.orders)
### Some random data to compare piecharts and thermometres:
tr <- rcoal(15)
x <- runif(14, 0, 0.33)
y <- runif(14, 0, 0.33)
z <- runif(14, 0, 0.33)
x <- cbind(x, y, z, 1 - x - y - z)
layout(matrix(1:2, 1, 2))
plot(tr, "c", FALSE, no.margin = TRUE)
nodelabels(pie = x, cex = 1.3)
text(4.5, 15, "Are you \"pie\"...", font = 4, cex = 1.5)
plot(tr, "c", FALSE, no.margin = TRUE)
nodelabels(thermo = x, col = rainbow(4), cex = 1.3)
text(4.5, 15, "... or \"thermo\"?", font = 4, cex = 1.5)
layout(matrix(1))

So, all in all, Ape is great :)

    Albert.


On 10/18/06, Jim Lemon <jim at bitwrit.com.au> wrote:
> Albert Vilella wrote:
> > Hi,
> >
> > I've been investigating the ape package for a while, and I was
> > wondering if it is possible to:
> >
> > - display the names of the internal nodes (from a newick tree)
> > - plot a pie-chart on top of each of the internal branches in a phylogram plot
> >
> I don't know about the first, but if you can specify the coordinates,
> floating.pie (plotrix) will display a pie chart there for you.
>
> Jim
>



More information about the R-help mailing list