View source: R/table.phylo4d.R
table.phylo4d | R Documentation |
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').
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,
...
)
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 |
col |
is |
coord.legend |
an optional list with two components 'x' and 'y'
indicating the lower-left position of the legend. Can be set to
|
... |
further arguments to be passed to plot methods from |
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
.
No return value, function produces only a plot.
Thibaut Jombart tjombart@imperial.ac.uk
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
.
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")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.