Sunday, October 21, 2012

Actual xkcd tree

In all my posts about the function for plotting xkcd style trees (e.g., 1, 2, 3, 4, 5, 6), I somehow overlooked the fact that there is an xkcd comic featuring a phylogenetic tree (more specifically, two trees - although the topological correctedness of the second is debatable). Furthermore, it is one of my favorite xkcd comics of all time:



Who knew that I should have been using this as a guide all along!

In the end, though (and with some tweaking of the settings from their default values, and a little post-hoc editing), my function does a pretty good job:

> require(phytools)
Loading required package: phytools
Loading required package: ape
...
> require("extrafont")
Loading required package: extrafont
> tree<-read.tree(text="((mammals,(birds,reptiles)),amphibians);")
> tree<-compute.brlen(tree)
> xkcdTree(tree,file="herpetology.pdf",lwd=2,color="black", dim=c(4,4),jitter=0.001,waver=c(0.03,0.03))
**** NOTE: use in Windows requires ...
>
That's it!

3 comments:

  1. Nathan Yau just featured a selection of xkcd-style charts (R, Java, Python) on his data visualization blog, FlowingData

    http://flowingdata.com/2012/10/19/xkcd-style-charts-in-r-javascript-and-python/

    ReplyDelete

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