Fylopic, an R wrapper to Phylopic
What is PhyloPic?
PhyloPic is an awesome new service - I’ll let the creator, Mike Keesey, explain what it is (paraphrasing here):
PhyloPic stores silhouette images of organisms, and each image is associated with taxonomic names, and stores the taxonomy of all taxa, allowing searching by taxonomic names. Anyone can submit silhouettes to PhyloPic.
What is a silhouette? It’s like this:
by Gareth Monger
What makes PhyloPic not just awesome, but super awesome? All or most images are licensed under Creative Commons licenses. This means you can use the silhouettes without having to ask or pay - just attribute.
What is fylopic?
The idea behind Fylopic is to create modular bits and pieces (i.e., functions) to allow you to add silhouettes to not only ggplot2 plots, but base plots as well. That is, you can simply load fylopic in your R session, and add some silhouettes to your phylogeny, or your barchart, etc. - that is,
fylopic is meant to be a helper in your workflow to add in silhouettes to visualizations.
Some people prefer base plots while others prefer ggplot2 plots (me!), so it would be nice to have both options. Phylogenies at the moment render faster in base plots. I don’t yet have implementations for base plots, but will come soon, or you can send a pull request to add it.
One interesting use case could be to be able to get a set of silhouettes, then get a phylogeny for taxa associatd with the silhouettess using the NCBI taxonomy, but it’s not easily available yet (though I may be able to use Ben Morris’ phylocommons soon. This isn’t doable yet, so in the example below the function
make_phylo creates a phylogeny using
You could also do the reverse -> you have a phylogeny and then you could search Phylopic for silhouettes.
Check out the Phylopic website here, and Phylopic API developer documentation here.
Also check out Ben Morris’ Python wrapper to Phylopic here.
What can you do with fylopic?
Plot a phylogeny with silhouettes at the tips
Here, I search for names based on keyword Homo sapiens - which returns many matche codes. With those results we search for any silhouettes associated with those codes. Then we download images. Finally, make a phylogeny with the silhouettes at the tips. Note that in this eample the phylogeny is just a random coalescent tree made using
ape::rcoal - obviously, in the real world you’d want to do something more useful.
Plot a silhouette behind a plot
Notice in the below example that you can use normal
ggplot2 syntax, and simply add another layer (
fylopic) to the plot.
This is a side project, so if anyone has interest in helping please do contribute code, report bugs, request features, etc.