Tuesday, May 9, 2017

New features in geo.legend for adding a geological (or arbitrary temporal) color legend to a plotted tree

I just pushed some new features for the phytools function geo.legend that I blogged about earlier today.

These features have the effect of invisibly exporting the legend & color scheme that was used to generate the plot. We can also completing turn-off plotting of the color legend (hence returning only the legend to be employed), which makes it easy to apply the legend to forward-in-time rather than merely on backward-in-time trees, as I will show:

## first get the legend without plotting
## flip the legend direction:
## plot it

plot of chunk unnamed-chunk-1

That's it.

This version of phytools can be obtained from GitHub using devtools.


  1. Hello, Mr. Revell.
    I am Bruno and I'm pretty new in R. This geoscaling legend is just awesome. I've got a phylogeny much less deep than this one. Its maximum height is 0.383. How could I do this kind of coloring in my tree using different time slices (like glacial periods, for example)?
    Thank you very very much for your blog and for helping.

    1. Actually I did find how to set a different timescale to the legend. However I'm having some trouble to flip the legend. It is saying I've got the wrong number of dimension in "leg[, 2]", which I don't know how to fix.
      Thank you very much again.


Note: due to the very large amount of spam, all comments are now automatically submitted for moderation.