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,mode,state=NULL)
addShift(SS,symbols.args=NULL)
RR |
the object produced by |
SS |
an object produced by |
mode |
if |
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 comparison between the real difference and the distributions
of random differences (see
search.shift
vignette#sparse). The
usage is:
...$plotStates(plot.args=NULL,points.args=NULL,legend.args=list())
,
where plot.args
is a list of further arguments passed to the function
plot
(used in the form: plot(y~x)
), 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 alphabetical order.
Silvia Castiglione, Giorgia Girardi
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)->plotSSauto
plotSSauto$plotClades()
plot(dinoRates$tree)
addShift(SS=SSauto)
search.shift(RR=dinoRates,status.type="clade",node=c(696,746))->SSnode
plotShift(RR=dinoRates,SS=SSnode,mode=2)->plotSSnode
plotSSnode$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)->plotSSstate
plotSSstate$plotStates(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.