Learn R Programming

monogeneaGM (version 1.1)

tpColorPlot3d: Color-annotated three-dimensional scatter plot with transparency control

Description

This function enhances a three-dimensional scatter plot by enabling transparency control of color annotation. In addition, it provides option for phylogenetic tree superimposition.

Usage

tpColorPlot3d(x, r = 0.005, phylo = FALSE, phy, labcol, xyzlabel = NULL, alpha.set = 0.2, mean.show = FALSE, asp = c(1, 1, 1))

Arguments

x
a matrix with rows representing samples and columns representing three variables of interest, typically principal components
r
radius of plotting sphere
phylo
if TRUE, coordinates of ancestral nodes from a supplied phylogeny (phy) are estimated using fastAnc from the phytools package, and edges between nodes are joined according to the topology specified in phy
phy
an object of class phylo from the ape package
labcol
a character vector specifying species colors
xyzlabel
a vector of characters specifying the titles for the xyz-axes
alpha.set
a constant for controlling degree of transparency (0 for complete transparency; 1 for solid color) of the data points
mean.show
if TRUE, the centroids of each species is plotted in solid color
asp
a vector specifying the aspect ratio of the xyz axes; the default gives a cube

Details

Transparency control of color-annotated data points reduces visual saturation caused by the use of solid colors for all data points. Guide for choosing optimal value of r: for data range between -0.1 and 0.1, a value of 0.005 should be adequate. If a phylogenetic tree is supplied, it may be superimposed onto the three-dimensional space to allow visualization of evolutionary trajectories.

References

Khang TF, Soo OYM, Tan WB, Lim LHS. (2016). Monogenean anchor morphometry: systematic value, phylogenetic signal, and evolution. PeerJ 4:e1668.

Paradis E, Claude J & Strimmer K. (2004). APE: analyses of phylogenetics and evolution in R language. Bioinformatics 20: 289-290.

Revell LJ. (2012). phytools: An R package for phylogenetic comparative biology (and other things). Methods in Ecology and Evolution 3:217-223.

See Also

tpColorPlot2d

Examples

Run this code
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