Learn R Programming

RRphylo (version 3.0.0)

plotRR: Plot the RRphylo output onto the phylogenetic tree

Description

This function generates customized functions to plot the phylogenetic tree (as returned by RRphylo) with branches colored according to phenotypic values or phenotypic evolutionary rates.

Usage

plotRR(RR,y,multivariate=NULL)

Value

The function returns a list of functions:

$plotRRphen charts phenotypic values along the tree branches. Phenotypes at tips are taken as they are from the y object. Phenotypic values for internal branches are derived from the RR$aces

object. The usage is:

...$plotRRphen(variable=NULL,tree.args=NULL,color.pal=NULL,colorbar.args=list()), where variable is the index or name of the variable to be plotted in case of multivariate data, tree.args is a list of further arguments passed to the function plot.phylo plus a logical indicating whether the tree should be ladderized before plotting (see examples below),

color.pal is a function to generate the color palette, and

colorbar.args is a list of further arguments passed to the function

colorbar (if = NULL the bar is not plotted).

$plotRRrates charts evolutionary rate values along the tree branches. The usage is identical to $plotRRphen. In case of multivariate data and multivariate = "rates", the argument

variable can be left unspecified.

Arguments

RR

an object produced by RRphylo.

y

the vector/matrix of phenotypic values used to perform RRphylo.

multivariate

if RRphylo was performed on multivariate data, this argument indicates whether individual rates for each variables (= "multiple.rates") or the norm2 vector of multivariate rates (= "rates") should be plotted.

Author

Silvia Castiglione, Pasquale Raia

See Also

Examples

Run this code
if (FALSE) {
data("DataApes")
DataApes$PCstage->PCstage
DataApes$Tstage->Tstage
cc<- 2/parallel::detectCores()

RRphylo(tree=Tstage,y=PCstage,clus=cc)->RRstage

plotRR(RRstage,y=PCstage,multivariate="multiple.rates")->pRR1
pRR1$plotRRphen(variable=1,tree.args=list(edge.width=2),color.pal=rainbow,
               colorbar.args = list(x="bottomleft",labs.adj=0.7,xpd=TRUE))
pRR1$plotRRrates(variable=2,tree.args=list(edge.width=2,direction="leftwards",ladderize=TRUE),
                color.pal=rainbow,colorbar.args = list(x="topright",labs.adj=0.7,xpd=TRUE))


plotRR(RRstage,y=PCstage,multivariate="rates")->pRR2
pRR2$plotRRrates(tree.args=list(edge.width=2),
                color.pal=hcl.colors,
                colorbar.args = list(x="topleft",labs.adj=0.7,xpd=TRUE,title.pos="bottom"))
}

Run the code above in your browser using DataLab