Three-dimensional phylogenetic tree "anchored" in a scatter plot I have a phylogenetic tree and data on two traits, x and y. To present them, I would like to show the phylogenetic relationships while preserving the xy positions in trait space (i.e., convex hulls). I presume this would be done in 3d. How can I do this in R?
 A: Once again, I ended up finding my own answer. The package is called "phytools", and the command is "fancyTree". You can visualize a projection of the phylogeny into trait space in 3 dimensions.
tree <- pbtree(n=10,scale=10)
Y <- sim.corrs(tree,vcv=matrix(c(1,0.75,0.75,1),2,2))
fancyTree(tree,type="traitgram3d",X=Y,control=list(spin=FALSE))


A: A 2D solution for simultaneously visualizing position in trait space and phylogenetic relationships is to use plotGMPhyloMorphoSpace from the geomorph package. This function shows species positions with respect to the first 2 principal components of the traits you provide it, so you can give it more than just 2 traits and it will plot them in a 2D trait space.
library(geomorph)
tree <- rcoal(n=20)
Y <- sim.corrs(tree,vcv=matrix(c(1,0.5,0.5,1),2,2))
plotGMPhyloMorphoSpace(tree, Y, node.labels=FALSE, 
    plot.param=list(t.cex=0.75, n.cex=0.5, txt.cex=0.5, lwd=0.5))


As with the 3D plot using fancyTree, things can get messy and you may want to trim the tree to taxa/clades of interest before plotting.
