Description Usage Arguments Value Author(s) Examples
View source: R/plotPhylo.motmot.R
Tree plotting for rates Plots trees with colours based on rates of trait evolution. Also provides simple coloured plotting for trait values using the "ace" function in the ape library.
1 2 3 4 5 6 7 8 | plotPhylo.motmot(phy, x = NULL, traitMedusaObject = NULL,
reconType = "rates", type = "phylogram", use.edge.length = TRUE,
show.tip.label = TRUE, show.node.label = FALSE, edge.color = "black",
edge.width = 1, edge.lty = 1, font = 3, cex = par("cex"),
adj = NULL, srt = 0, no.margin = FALSE, root.edge = FALSE,
label.offset = 0.5, underscore = FALSE, x.lim = NULL, y.lim = NULL,
direction = "rightwards", lab4ut = "horizontal", tip.color = "black",
palette = "hotspot.colors")
|
phy |
An object of class "phylo" (see ape package). |
x |
A matrix of trait values. |
traitMedusaObject |
Output from traitMedusaSummary. |
reconType |
Colour branches according to rate shifts ("rates" - requires traitMedusaObject) or ancestral state reconstruction ("picReconstruction" - requires x). |
type |
a character string specifying the type of phylogeny to be drawn; it must be one of "phylogram" (the default), "cladogram", "fan", "unrooted", "radial" or any unambiguous abbreviation of these. |
use.edge.length |
a logical indicating whether to use the edge lengths of the phylogeny to draw the branches (the default) or not (if |
show.tip.label |
a logical indicating whether to show the tip labels on the phylogeny (defaults to |
show.node.label |
a logical indicating whether to show the node labels on the phylogeny (defaults to |
edge.color |
a vector of mode character giving the colours used to draw the branches of the plotted phylogeny. These are taken to be in the same order than the component |
edge.width |
a numeric vector giving the width of the branches of the plotted phylogeny. These are taken to be in the same order than the component |
edge.lty |
same than the previous argument but for line types; 1: plain, 2: dashed, 3: dotted, 4: dotdash, 5: longdash, 6: twodash. |
font |
an integer specifying the type of font for the labels: 1 (plain text), 2 (bold), 3 (italic, the default), or 4 (bold italic). |
cex |
a numeric value giving the factor scaling of the tip and node labels (Character EXpansion). The default is to take the current value from the graphical parameters. |
srt |
a numeric giving how much the labels are rotated in degrees (negative values are allowed resulting in clock-like rotation); the value has an effect respectively to the value of |
no.margin |
a logical. If |
root.edge |
a logical indicating whether to draw the root edge (defaults to FALSE); this has no effect if ‘use.edge.length = FALSE’ or if ‘type = "unrooted"’. |
label.offset |
a numeric giving the space between the nodes and the tips of the phylogeny and their corresponding labels. This option has no effect if |
underscore |
a logical specifying whether the underscores in tip labels should be written as spaces (the default) or left as are (if |
x.lim |
a numeric vector of length one or two giving the limit(s) of the x-axis. If |
y.lim |
same than above for the y-axis. |
direction |
a character string specifying the direction of the tree. Four values are possible: "rightwards" (the default),"leftwards", "upwards", and "downwards". |
lab4ut |
(= labels for unrooted trees) a character string specifying the display of tip labels for unrooted trees: either |
tip.color |
the colours used for the tip labels, eventually recycled (see examples). |
palette |
Defines the colour scheme with four options: hotspot.colors (red to blue), heat.colors (yellow to red), cool.colors (blues), combi.colors (yellows to reds and blues) |
adj |
a |
numeric specifying the justification of the text strings of the labels: 0 (left-justification), 0.5 (centering), or 1 (right-justification). This option has no effect if type ="unrooted"
. If NULL
(the default) the value is set with respect of direction
(see details).
Returns a data frame of colours used in plot along with rate (or ancestral state) range for each colour.
Gavin Thomas
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # Data and phylogeny
data(anolis.tree)
data(anolis.data)
# female SVL data
female.svl <- matrix(anolis.data[,"Female_SVL"],
dimnames=list(rownames(anolis.data)))
input.data <- sortTraitData(phy=anolis.tree, y=female.svl, log.trait=TRUE)
# arbitarily reduce data size for speed in this example
phy.clade <- extract.clade(input.data[[1]], 182)
male.length.clade <- as.matrix(input.data[[2]][match(input.data[[1]]$tip.label,
rownames(input.data[[2]])),])
# Identify rate shifts and print and plot results with up to one rate shifts
# and minimum clade size of 10.
anolisSVL_MEDUSA <- transformPhylo.ML(male.length.clade, phy=phy.clade,
model="tm1",minCladeSize=10, nSplits=1)
anolisSVL_MEDUSA_out <- traitMedusaSummary(anolisSVL_MEDUSA,
cutoff=1, AICc=FALSE)
colours <- plotPhylo.motmot(phy=phy.clade, traitMedusaObject = anolisSVL_MEDUSA_out,
reconType = "rates", type = "fan", cex=0.6, edge.width=3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.