Monday, February 1, 2016

Standardization method for dotTree, and comparison of two different methods for visualizing quantitative character data at the tips of the tree

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:

## 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
## unstandardized

plot of chunk unnamed-chunk-1

dotTree(tree,X,length=8) ## lengthen the legend

plot of chunk unnamed-chunk-1

## standardized

plot of chunk unnamed-chunk-1


plot of chunk unnamed-chunk-1

That's it.


  1. When characters are binary or multistate, the legend could change accordingly, instead of showing them as continuous.

    1. This 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.

  2. Hi Liam,

    I just ran the code and I get this graph with dotTree:


  3. Replies
    1. Hola Marcelo.

      Yes, 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:


      Let me know if this works. - Liam