library(phytools)
library(rgl)
data(ligophorus_shape)
data(ligotree)
data(spcolmap)
#Perform PCA of shape data for dorsal anchors and make 2D plots
pcashape <- pca2d(ligophorus_shape[,23:44], labcol=spcolmap$color,
phylo=TRUE, phy=ligotree, genus="L. ", bound.y=c(-0.08, 0.1),
bound.x1=c(-0.2,0.2), bound.x2 = c(-0.2,0.2))
#Check for proportion of variation explained by each PC
summary(pcashape$pca)
#A closer look with 3D plot
tpColorPlot3d(pcashape$scores[,3:1], r=0.005, phylo=TRUE, phy=ligotree, labcol=spcolmap$color,
xyzlabel=c("PC3 (8%)","PC2 (10%)","PC1 (61%)"), mean.show=TRUE)
Run the code above in your browser using DataLab