plotRR: Plot the RRphylo output onto the phylogenetic tree

View source: R/plotRR.R

plotRRR Documentation

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)

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.

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

Author(s)

Silvia Castiglione, Pasquale Raia

See Also

RRphylo vignette

RRphylo vignette

plotRR vignette

Examples

## Not run: 
data("DataApes")
DataApes$PCstage->PCstage
DataApes$Tstage->Tstage
cc<- 2/parallel::detectCores()

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

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


plotRR(RR,y=PCstage,multivariate="rates")->pRR
pRR$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"))

## End(Not run)

RRphylo documentation built on June 7, 2023, 5:49 p.m.