plotShift | R Documentation |
plotShift
generates customized functions to produce plots
out of search.shift
results.
addShift
adds circles to highlight shifting clades onto the currently
plotted tree.
plotShift(RR,SS,state=NULL)
addShift(SS,symbols.args=NULL)
RR |
the object produced by |
SS |
an object produced by |
state |
if |
symbols.args |
as described for |
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.
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
.
Silvia Castiglione
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
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.