In the past few days I have posted two different visualization methods that can
both be used to visualize continuous trait data for multiple characters across
the tips of a tree. The first, phylo.heatmap
, plots a multivariate
'heatmap' of trait values for multiple characters in a grid (e.g.,
1,
2).
The second, dotTree
, shows one or multiple traits plotted on the
tips of the tree using different sized circles or dots (e.g.,
1,
2).
Tonight, I added the same standardization option that was already available in
phylo.heatmap
to dotTree
. This update can be seen
here.
Having done this, I thought it might be interesting to visually compare the
two methods, since they are effectively being used to represent the same data.
Here is what that looks like:
library(phytools)
## Loading required package: ape
## Loading required package: maps
##
## # ATTENTION: maps v3.0 has an updated 'world' map. #
## # Many country borders and names have changed since 1990. #
## # Type '?world' or 'news(package="maps")'. See README_v3. #
## simulate tree & data for 6 traits
tree<-rtree(n=26,tip.label=LETTERS)
X<-fastBM(tree,nsim=6)
## unstandardized
phylo.heatmap(tree,X)
dotTree(tree,X,length=8) ## lengthen the legend
## standardized
phylo.heatmap(tree,X,standardize=TRUE)
dotTree(tree,X,standardize=TRUE,length=8)
That's it.
When characters are binary or multistate, the legend could change accordingly, instead of showing them as continuous.
ReplyDeleteThis is already done for one or multiple discrete characters: here. Let me know if you're having problems and how. If you have numerically coded your discrete traits then the function will treat them as numerical values, unless instructed otherwise.
DeleteHi Liam,
ReplyDeleteI just ran the code and I get this graph with dotTree:
https://www.dropbox.com/s/0bltga5mfxd0ovl/dotTree.jpeg?dl=0
Cheers
package version 0.5.32
ReplyDeleteHola Marcelo.
DeleteYes, this is a known bug - but it is with plotrix, not phytools. To get it to work try installing a previous version of plotrix as follows:
install.packages(
"https://cran.r-project.org/src/contrib/Archive/plotrix/plotrix_3.6-1.tar.gz",
type="source")
Let me know if this works. - Liam
Vi tilbyder dig alle verdensberømte Billige Luksus Ure med samme udseende, samme kvalitet og samme materiale ... du kan ikke se, hvilken er en omega replika ure lige med dine øjne overhovedet!
ReplyDelete