Thursday, May 18, 2023

Arc-style tree & arc text (just for fun)

Yesterday, I tweeted a plot giving an arc-style tree with arc text.

Since people seem to like this, I thought I’d post the code. The arc text uses the plotrix function arctext.

library(phytools)
tree<-pbtree(n=1200,scale=18)
arc_height<-1.8
par(fg="white",bg="#242B64")
plotTree(tree,ftype="off",type="arc",color="grey",arc_height=1.8,
  ylim=c(0,3.2*max(nodeHeights(tree))))
library(plotrix)
text(x=0,y=1.08*(arc_height+1)*max(nodeHeights(tree)),
  "phytools 2.0",cex=4)
arctext("An updated R ecosystem for phylogenetic comparative methods",
  radius=30,cex=2.4)
text(x=0,y=24,"(and other things)",cex=1.8)

plot of chunk unnamed-chunk-2

That’s it folks!

No comments:

Post a Comment

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