Learn R Programming

monogeneaGM (version 1.1)

tpColorPlot2d: Color-annotated scatter plot with transparency control

Description

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

Usage

tpColorPlot2d(x, labcol = "", xlab = "", ylab = "", tit = "", circlesize = rep(1.5, nrow(x)), tpfac = c(60, 255), xbound = NULL, ybound = NULL, centroid = FALSE, phylo = FALSE, phy, pointscale = 1)

Arguments

x
a two-column matrix with rownames (usually, the species names)
labcol
a character vector specifying species colors
xlab
title for the x-axis
ylab
title for the y-axis
tit
title for the plot
circlesize
a numeric vector that controls the centroid symbol size; defaults to 1 if centroid = FALSE
tpfac
a numeric vector specifying the transparency level (0 to 255) for individual data points and the label mean
xbound
range of values on the x-axis
ybound
range of values on the y-axis
centroid
if TRUE, plots the centroid for each species
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
pointscale
a constant for controlling the size of the plotted ancestral nodes

Details

Transparency control of color-annotated data points reduces visual saturation caused by the use of solid colours, thus allowing species centroids to be accentuated in the plot. In addition, if a user-supplied phylogeny is given, it is superimposed onto the plot. This function depends on the phytools (Revell, 2012) and ape (Paradis et al., 2004) packages.

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.

Examples

Run this code
data(pwed_pd)
data(spcolmap)

pwed_pd_list <- matrix2list.2(pwed_pd)
lm1 <- c("V1_3","V1_5")

#scatter plot of LM1-LM3 length against LM1-LM5 length for the ventral anchors
tpColorPlot2d(pwed_pd[,colnames(pwed_pd) %in% lm1], labcol=spcolmap$color,
xlab=expression(paste("V1_3 ", "(", italic(mu),"m", ")")),
ylab=expression(paste("V1_5 ", "(", italic(mu),"m", ")")), centroid=TRUE)

Run the code above in your browser using DataLab