plotPhylo.motmot: Tree plotting for rates Plots trees with colours based on...

Description Usage Arguments Value Author(s) Examples

View source: R/plotPhylo.motmot.R

Description

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.

Usage

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")

Arguments

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 FALSE). This option has no effect if the object of class "phylo" has no ‘edge.length’ element.

show.tip.label

a logical indicating whether to show the tip labels on the phylogeny (defaults to TRUE, i.e. the labels are shown).

show.node.label

a logical indicating whether to show the node labels on the phylogeny (defaults to FALSE, i.e. the labels are not shown).

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 of phy. If fewer colours are given than the length of edge, then the colours are recycled.

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 of phy. If fewer widths are given than the length of edge, then these are recycled.

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 direction (see Examples). This option has no effect if type = "unrooted".

no.margin

a logical. If TRUE, the margins are set to zero and the plot uses all the space of the device (note that this was the behaviour of plot.phylo up to version 0.2-1 of ‘ape’ with no way to modify it by the user, at least easily).

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 type = "unrooted".

underscore

a logical specifying whether the underscores in tip labels should be written as spaces (the default) or left as are (ifTRUE).

x.lim

a numeric vector of length one or two giving the limit(s) of the x-axis. If NULL, this is computed with respect to various parameters such as the string lengths of the labels and the branch lengths. If a single value is given, this is taken as the upper limit.

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 "horizontal" where all labels are horizontal (the default), or "axial" where the labels are displayed in the axis of the corresponding terminal branches. This option has an effect only if type = "unrooted".

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).

Value

Returns a data frame of colours used in plot along with rate (or ancestral state) range for each colour.

Author(s)

Gavin Thomas

Examples

 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)

motmot.2.0 documentation built on May 1, 2019, 9:22 p.m.