An R-sig-phylo question asked:
“I have made an ancestral state reconstruction for three discrete traits using the R package "phytools”,and I don't know how to draw the three asr pies on the node in a single plot.“
Although this can get messy, it is possible to do this using the argument
adj
. For instance:
library(phytools)
plotTree(tree)
nodelabels(pie=p1,adj=c(0.5,0.9),cex=0.5)
nodelabels(pie=p2,adj=c(0.5,0.5),cex=0.5)
nodelabels(pie=p3,adj=c(0.5,0.1),cex=0.5)
to arrange vertically. To arrange horizontally, do:
plotTree(tree)
nodelabels(pie=p1,adj=c(0.445,0.5),cex=0.5)
nodelabels(pie=p2,adj=c(0.5,0.5),cex=0.5)
nodelabels(pie=p3,adj=c(0.555,0.5),cex=0.5)
The specific values for adj
will depend on the scale of the
tree & the number of tips.
Hi Liam
ReplyDeleteI wonder if there is a way to remove the outline of the pies i.e. remove the black borders of the pies
You can do:
Delete`par(fg="transparent")`
add the node labels, and then run:
`par(fg="black")`
All the best, Liam