plotTrend {RRphylo} | R Documentation |
Graphical representation of search.trend results
Description
This function generates customized functions to produce plots of
phenotype versus time and absolute evolutionary rates versus time
regressions for the entire phylogeny and individual clades. Each custom
function takes as first argument the index or name of the variable (as in
the search.trend
output in $trends.data$phenotypeVStime
) to be
plotted.
Usage
plotTrend(ST)
Arguments
ST |
an object produced by |
Value
The function returns a list of functions:
$plotSTphen
returns the plot of rescaled phenotype versus age
regression. The 95% confidence intervals of slopes produced by regressing
phenotypes simulated under the Brownian motion are plotted as a polygon. The
usage is
...$plotSTphen(variable,plot.args=NULL,polygon.args=NULL,line.args=NULL)
,
where variable
is the index or name of the variable to be plotted,
plot.args
is a list of further arguments passed to the function
plot
, polygon.args
is a list of further arguments passed to
the function polygon
, and line.args
is a list of further
arguments passed to the function lines
. The functions automatically
plots white points for internal nodes, red points for tips, a blue
regression line, and a gray shaded polygon to represent the 95% confidence
intervals of Brownian motion slopes.
$plotSTrates
returns the plot of log rescaled rates versus age
regression. The 95% confidence intervals of slopes produced by regressing
rates simulated under the Brownian motion are plotted as a shaded area. The
arguments are the same as described for $plotSTphen
. In the case of
multivariate y
, the 2-norm vector of multiple rates (see
RRphylo
for details) can be plotted by setting variable
= "rate"
or variable =
the number of actual variables + 1.
$plotSTphenNode
returns plots of rescaled phenotype versus age
regression for individual clades. The usage is
...$plotSTphenNode(variable,node,plot.args=NULL,lineTree.args=NULL,
lineNode.args=NULL,node.palette=NULL)
, where variable
is the
same as plotSTphen
and node
is the vector of indices or numbers
(as inputted to search.trend
, to be indicated as character) of nodes
to be plotted. The function allows up to nine nodes at the same time.
plot.args
is a list of further arguments passed to the function
plot
, including pch.node
, a custom argument to set individual
pch
at nodes (its length can be one or as long as the number of
nodes). lineTree.args
is a list of further arguments passed to the
function lines
used to plot the regression line for the entire tree
lineNode.args
is a list of further arguments passed to the function
lines
used to plot the regression line for individual nodes.
node.palette
is the vector of colors specific to nodes points and
lines. Its length can be one or as long as the number of nodes.
$plotSTratesNode
returns plots of absolute rates versus age
regression for individual clades. The arguments are the same as described
for $plotSTphenNode
. In the case of multivariate y
, the 2-norm
vector of multiple rates (see RRphylo
for details) can be
plotted by setting variable = "rate"
or variable =
the number
of actual variables + 1.
Author(s)
Silvia Castiglione, Carmela Serio
References
Castiglione, S., Serio, C., Mondanaro, A., Di Febbraro, M., Profico, A., Girardi, G., & Raia, P. (2019) Simultaneous detection of macroevolutionary patterns in phenotypic means and rate of change with and within phylogenetic trees including extinct species. PLoS ONE, 14: e0210101. https://doi.org/10.1371/journal.pone.0210101
See Also
Examples
## Not run:
data("DataOrnithodirans")
DataOrnithodirans$treedino->treedino
DataOrnithodirans$massdino->massdino
cc<- 2/parallel::detectCores()
# Extract Pterosaurs tree and data
library(ape)
extract.clade(treedino,746)->treeptero
massdino[match(treeptero$tip.label,names(massdino))]->massptero
massptero[match(treeptero$tip.label,names(massptero))]->massptero
RRphylo(tree=treeptero,y=log(massptero),clus=cc)->RRptero
search.trend(RR=RRptero, y=log(massptero), nsim=100, node=143, clus=cc,cov=NULL)->ST
plotTrend(ST)->plotST
plotST$plotSTphen(1) # to plot phenotypic trend through time for entire tree
plotST$plotSTphen("log(massptero)",plot.args=list(cex=1.2,col="blue")) # equivalent to above
plotST$plotSTrates(1) # to plot rates trend through time for entire tree
# to plot phenotypic trend through time for the clade
plotST$plotSTphenNode("log(massptero)",plot.args=list(xlab="Age",main="Phenotypic trend"),
lineTree.args=list(lty=1,col="pink"),lineNode.args=list(lwd=3),
node.palette=c("chartreuse"))
# to plot rates trend through time for the clade
plotST$plotSTratesNode("rate")
## End(Not run)