Pages

Thursday, April 30, 2020

“I've been using the function phylomorphospace and I was wondering if it's possible to colour-code
specific clades of interest on the phylomorphospace. I just think this would be cool to visualize how
phylogenetically similar species are also grouped together in the plot. Any help would be hugely
appreciated.”

In fact, I posted about
this some time ago - but since that post is nearly 7 years old (!!) I thought it might be worth quickly
revisiting.

So - how do we do this? Well, we're going to make use of the handy function paintSubTree to map the
clades we want to paint on the tree. paintSubTree creates an object of class "simmap". When we pass
this object to phylomorphospace it will automatically show the edges of our different clades with
different colors.

Our first step, of course, is to load phytools. You'll see that I'm using a version of phytools that
(as of the day of writing) is newer than the one on CRAN. For the purposes of this exercise, the CRAN
version should work just fine - though I do recommend updating phytools to the GitHub version using
devtools when it is convenient.

library(phytools)
packageVersion("phytools")

## [1] '0.7.20'

Now, I'm going to use simulated data for the purposes of our exercise here. I imagine the reader will
use their own data & tree. The code I used to obtain these data is at the end of the exercise.

About this blog

This web-log chronicles the development of new tools for phylogenetic analyses in the phytools R package. Unless you a reading a very recent page of the blog, I recommend that you install the latest CRAN version of phytools (or latest beta release) before attempting to replicate any of the analyses of this site. That is because the linked functions may be archived, and very likely have been replaced by newer versions.