This is kind of cool: a multipanel phylomorphospace plot for four different traits with a set of contMap univariate plots on the diagonal:
Here's how I did it (ignoring the data simulation). Note that a new, non-CRAN version of phytools (phytools 0.2-96) is required to do this.
m<-ncol(X)
par(mfrow=c(m,m))
par(cex=0.6)
par(mar=c(0,0,0,0))
par(oma=c(5,5,3,3))
m<-ncol(X)
for(i in 1:m) for(j in 1:m){
if(i==j) contMap(tree,X[,i],legend=FALSE,lwd=2,outline=F,
fsize=0.5)
else {
phylomorphospace(tree,X[,c(j,i)],lwd=1,
node.by.map=TRUE,axes=FALSE)
if(i==1) axis(side=3) # top row
if(i==m) axis(side=1) # first column
if(j==1) axis(side=2) # bottom row
if(j==m) axis(side=4) # last column
}
}
par(cex=0.9)
mapply(title,xlab=colnames(X),adj=
seq(0,(m-1)/m,1/m)+1/(2*m),MoreArgs=
list(outer=TRUE,cex=0.9))
mapply(title,ylab=colnames(X)[m:1],adj=
seq(0,(m-1)/m,1/m)+1/(2*m),MoreArgs=
list(outer=TRUE,cex=0.9))
par(mfrow=c(m,m))
par(cex=0.6)
par(mar=c(0,0,0,0))
par(oma=c(5,5,3,3))
m<-ncol(X)
for(i in 1:m) for(j in 1:m){
if(i==j) contMap(tree,X[,i],legend=FALSE,lwd=2,outline=F,
fsize=0.5)
else {
phylomorphospace(tree,X[,c(j,i)],lwd=1,
node.by.map=TRUE,axes=FALSE)
if(i==1) axis(side=3) # top row
if(i==m) axis(side=1) # first column
if(j==1) axis(side=2) # bottom row
if(j==m) axis(side=4) # last column
}
}
par(cex=0.9)
mapply(title,xlab=colnames(X),adj=
seq(0,(m-1)/m,1/m)+1/(2*m),MoreArgs=
list(outer=TRUE,cex=0.9))
mapply(title,ylab=colnames(X)[m:1],adj=
seq(0,(m-1)/m,1/m)+1/(2*m),MoreArgs=
list(outer=TRUE,cex=0.9))
Dear Liam,
ReplyDeleteI find this R package very useful! but I have a very basic question, has any sense if I map onto the phylogeny the relative scores (each RW axis) which I have obtained from a geometric morphometric analysis? I want to build a phylomorphospace using relative warps (as in Sidlauskas 2008) and I found interesting this kind of visualization.
Another question would be: is it possible mapping procrustes distances between tips and nodes?
Thanks for your time,
Best regard,
Alicia