ggtree collapsed clade+images
0
0
Entering edit mode
2.2 years ago
Gabriel R. ★ 2.9k

In ggtree you can add images to tips as such:

 library(ape)
 tree <- read.nexus("https://raw.githubusercontent.com/rgriff23/Dissertation/master/Chapter_2/data/tree.nex")
 phylopic_info <- data.frame(node = c(124, 113, 110, 96, 89, 70),
                             phylopic = c("7fb9bea8-e758-4986-afb2-95a2c3bf983d",
                                         "bac25f49-97a4-4aec-beb6-f542158ebd23",
                                         "f598fb39-facf-43ea-a576-1861304b2fe4",
                                         "aceb287d-84cf-46f1-868c-4797c4ac54a8",
                                         "0174801d-15a6-4668-bfe0-4c421fbe51e8",
                                         "72f2f854-f3cd-4666-887c-35d5c256ab0f"),
                             species = c("galagoids", "lemurs", "tarsiers",
                                         "cebids", "hominoids", "cercopithecoids"))
 pg <- ggtree(tree)
 pg %<+% phylopic_info + geom_nodelab(aes(image=phylopic), geom="phylopic", alpha=.5, color='steelblue')

 d <- data.frame(node = c("70","89","96","110","113","124"),
                 images = c("https://i.imgur.com/8VA9cYw.png",
                             "https://i.imgur.com/XYM1T2x.png",
                             "https://i.imgur.com/EQs5ZZe.png",
                             "https://i.imgur.com/2xin0UK.png",
                             "https://i.imgur.com/hbftayl.png",
                             "https://i.imgur.com/3wDHW8n.png"))
 pg %<+% d + geom_nodelab(aes(image=images), geom="image")

However, is there anyone who has gotten it to work with collapsed clades using:

tree+collapse(node=nodeid)+geom_cladelabel(node=nodeid, "New clade", align=TRUE)

for example? I know there is a geom image in geom_cladelabel but can that be used? If so, how?

ggtree plotting R phylogenetics • 447 views
ADD COMMENT

Login before adding your answer.

Traffic: 1782 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6