Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

table.phylo4d

Graphical display of phylogeny and traits


Description

This function represents traits onto the tips of a phylogeny. Plotted objects must be valid phylo4d objects (implemented by the phylobase package). Current version allows plotting of a tree and one or more quantitative traits (possibly containing missing data, represented by an 'x').

Usage

table.phylo4d(x, treetype = c("phylogram", "cladogram"),
  symbol = c("circles", "squares", "colors"), repVar = 1:ncol(tdata(x, type
  = "tip")), center = TRUE, scale = TRUE, legend = TRUE, grid = TRUE,
  box = TRUE, show.tip.label = TRUE, show.node.label = TRUE,
  show.var.label = TRUE, ratio.tree = 1/3, font = 3,
  tip.label = tipLabels(x), var.label = colnames(tdata(x, type = "tip")),
  cex.symbol = 1, cex.label = 1, cex.legend = 1, pch = 20,
  col = heat.colors(100), coord.legend = NULL, ...)

Arguments

x

a phylo4d object

treetype

the type of tree to be plotted ("phylogram" or "cladogram")

symbol

the type of symbol used to represent data ("circles", "squares", or "colors")

repVar

the numerical index of variables to be plotted

center

a logical stating whether variables should be centred (TRUE, default) or not (FALSE)

scale

a logical stating whether variables should be scaled (TRUE, default) or not (FALSE)

legend

a logical stating whether a legend should be added to the plot (TRUE) or not (FALSE, default)

grid

a logical stating whether a grid should be added to the plot (TRUE, default) or not (FALSE)

box

a logical stating whether a box should be added around the plot (TRUE, default) or not (FALSE)

show.tip.label

a logical stating whether tip labels should be printed (TRUE, default) or not (FALSE)

show.node.label

a logical stating whether node labels should be printed (TRUE, default) or not (FALSE)

show.var.label

a logical stating whether labels of variables should be printed (TRUE, default) or not (FALSE)

ratio.tree

the proportion of width of the figure occupied by the tree

font

an integer specifying the type of font for the labels: 1 (plain text), 2 (bold), 3 (italic, default), or 4 (bold italic).

tip.label

a character vector giving the tip labels

var.label

a character vector giving the labels of variables

cex.symbol

a numeric giving the factor scaling the symbols

cex.label

a numeric giving the factor scaling all labels

cex.legend

a numeric giving the factor scaling the legend

pch

is symbol is set to 'colors', a number indicating the type of point to be plotted (see ?points)

col

is symbol is set to 'colors', a vector of colors to be used to represent the data

coord.legend

an optional list with two components 'x' and 'y' indicating the lower-left position of the legend. Can be set to locator(1) to position the legend interactively.

...

further arguments to be passed to plot methods from ape. See plot.phylo.

Details

The plot of phylogenies is performed by a call to plot.phylo from the ape package. Hence, many of the arguments of plot.phylo can be passed to table.phylo4d, through the ... argument, but their names must be complete.

For large trees, consider using bullseye.

The function table.phylo4d is based on former plot method for phylo4d objects from the phylobase package. It replaces the deprecated ade4 functions symbols.phylog and table.phylog.

Author(s)

Thibaut Jombart tjombart@imperial.ac.uk

See Also

The phylo4d class for storing phylogeny+data.

For large trees, consider using bullseye.

plot.phylo from the ape package.

An alternative (deprecated) representation is available from dotchart.phylog.

Examples

if(require(ape) & require(phylobase) & require(ade4)){

## simulated data
tr <- rtree(20)
dat <- data.frame(a = rnorm(20), b = scale(1:20), c=runif(20,-2,2) )
dat[3:6, 2] <- NA # introduce some NAs
obj <- phylo4d(tr, dat) # build a phylo4d object
table.phylo4d(obj) # default scatterplot
table.phylo4d(obj,cex.leg=.6, use.edge.length=FALSE) # customized
table.phylo4d(obj,treetype="clad", show.node=FALSE, cex.leg=.6,
use.edge.length=FALSE, edge.color="blue", edge.width=3) # more customized


## teleost fishes data
data(mjrochet)
temp <- read.tree(text=mjrochet$tre) # make a tree
mjr <- phylo4d(x=temp,tip.data=mjrochet$tab) # male a phylo4d object
table.phylo4d(mjr,cex.lab=.5,show.node=FALSE,symb="square")


## lizards data
data(lizards)
liz.tr <- read.tree(tex=lizards$hprA) # make a tree
liz <- phylo4d(liz.tr, lizards$traits) # make a phylo4d object
table.phylo4d(liz)


## plotting principal components
liz.pca1 <- dudi.pca(lizards$traits, scannf=FALSE, nf=2) # PCA of traits
myPC <- phylo4d(liz.tr, liz.pca1$li) # store PC in a phylo4d object
varlab <- paste("Principal \ncomponent", 1:2) # make labels for PCs
table.phylo4d(myPC, ratio=.8, var.lab=varlab) # plot the PCs
add.scatter.eig(liz.pca1$eig,2,1,2,posi="topleft", inset=c(0,.15))
title("Phylogeny and the principal components")

}

adephylo

Exploratory Analyses for the Phylogenetic Comparative Method

v1.1-11
GPL (>= 2)
Authors
Thibaut Jombart <t.jombart@imperial.ac.uk>, Stéphane Dray <stephane.dray@univ-lyon1.fr>, Anders Ellern Bilgrau <abilgrau@math.aau.dk>
Initial release
2017-12-18

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.