plotShift: Graphical representation of search.shift results

View source: R/plotShift.R

plotShiftR Documentation

Graphical representation of search.shift results

Description

plotShift generates customized functions to produce plots out of search.shift results. addShift adds circles to highlight shifting clades onto the currently plotted tree.

Usage

plotShift(RR,SS,state=NULL)

addShift(SS,symbols.args=NULL)

Arguments

RR

the object produced by RRphylo used to perform search.shift.

SS

an object produced by search.shift.

state

if search.shift was performed under status.type = "sparse", this is the same state vector provided to the function.

symbols.args

as described for $plotClades below.

Details

Using ...$plotClades() or plotting the tree and applying addShift() returns the same plot. The latter function might be useful in combination with plotRR to add the shifts information to the branch-wise plot of evolutionary rate values.

Value

The function returns a function to generate a customizable plot of search.shift results.

If search.shift was performed under status.type = "clade", plotShift returns a $plotClades function which highlights the shifting clades onto the phylogenetic tree. The usage is: ...$plotClades(tree.args=NULL,symbols.args=NULL), where tree.args is a list of further arguments passed to the function plot.phylo, and symbols.args is a list of further arguments passed to the function symbols (n.b. the shape of the symbol is not customizable). The function automatically plots red circles for negative shifts and blue circles for positive shifts, in each cases with the radium proportional to the absolute value of rate difference. The user can choose different color options for positive/negative shifts by setting symbols.args=list(fg=c(pos="color for positive shift",neg="color for negative shift")), or provide a vector of as many colors as the number of shifting clades. The same applies to the argument "bg".

If search.shift was performed under status.type = "sparse", plotShift returns a $plotStates function which plots the states onto the phylogenetic trees. The usage is: ...$plotStates(tree.args=NULL,points.args=NULL,legend.args=list()), where tree.args is a list of further arguments passed to the function plot.phylo, points.args is a list of further arguments passed to the function points, and legend.args is a list of additional arguments passed to the function legend (if = NULL the legend is not plotted). If as many colors/pch values as the number of different states are provided in points.args, each of them is assigned to each states taken in the same order they are returned by search.shift.

Author(s)

Silvia Castiglione

References

Castiglione, S., Tesone, G., Piccolo, M., Melchionna, M., Mondanaro, A., Serio, C., Di Febbraro, M., & Raia, P.(2018). A new method for testing evolutionary rate variation and shifts in phenotypic evolution. Methods in Ecology and Evolution, 9: 974-983.doi:10.1111/2041-210X.12954

See Also

search.shift vignette

plotShift vignette

Examples

## Not run: 
data("DataOrnithodirans")
DataOrnithodirans$treedino->treedino
DataOrnithodirans$massdino->massdino
DataOrnithodirans$statedino->statedino
cc<- 2/parallel::detectCores()

RRphylo(tree=treedino,y=massdino,clus=cc)->dinoRates

search.shift(RR=dinoRates,status.type="clade")->SSauto
plotShift(RR=dinoRates,SS=SSauto)->plotSS
plotSS$plotClades()

plot(dinoRates$tree)
addShift(SS=SSauto)

search.shift(RR=dinoRates,status.type="clade",node=c(696,746))->SSnode
plotShift(RR=dinoRates,SS=SSnode)->plotSS
plotSS$plotClades(tree.args=list(no.margin=TRUE),
                  symbols.args=list(fg=NA,bg=c(pos="cyan",neg="magenta")))


search.shift(RR=dinoRates,status.type= "sparse",state=statedino)->SSstate
plotShift(RR=dinoRates,SS=SSstate,state=statedino)->plotSS
plotSS$plotStates(tree.args=list(no.margin=TRUE),
                  points.args=list(bg=c("gold","forestgreen","royalblue","white"),
                                   col=c("black","black","black","orangered"),
                                   pch=c(21,22,24,11)),legend.args=list())
    
## End(Not run)

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