Friday, April 14, 2023

ansi_phylo plotter generalized to arbitrary text characters

After writing yesterday about how to create an ANSI text graphic style phylogeny using - and | characters, it occurred to me that this could be generalized to any character type, such as * or even letters. Of course, I couldn’t resist adding this in to phytools. (I can’t promise I won’t take it out again later.)

Here are a couple of examples.

library(phytools)
data(bat.tree)
ansi_phylo(bat.tree,vertical="#",horizontal="*")

plot of chunk unnamed-chunk-18

Here, let’s cheat a little and change our character size for branches and tip labels. (This is not really ANSI, because that wouldn’t be allowed.)

par(cex=0.4)
data(mammal.tree)
ansi_phylo(mammal.tree,vertical="/",horizontal="/",fsize=1.3)

plot of chunk unnamed-chunk-19

Being honest, that’s not half bad, right?

If we want to be really silly, we can even use letters.

data(sunfish.tree)
ansi_phylo(sunfish.tree,vertical="b",horizontal="a")

plot of chunk unnamed-chunk-20

1 comment:

  1. Next step of geekyness is plotting the ancestral states as one letter code in ansi_phylo like plotSimmap ;)
    Cheers,
    Klaus

    ReplyDelete

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