Hi, I have huge tree (over 2000 tips) and wanted to color it by metadata. I managed to do this like this:
Test=ggtree(tre, layout="fan",open.angle=120) %<+% Reino +
aes(color = I(Reino))+ # color the branches according to a variable in your dataframe
scale_color_manual(
name = "Kingdom",
breaks = c('Bacteria', 'Eukaryota', 'unclassified sequences', 'Archaea','Dash'), # the different options in your variable
values = c("#a6611a","#dfc27d","#f5f5f5","#80cdc1","#018571","#D3D3D3"))
I've managed to export the tree object into an annotated file like this:
p=as.treedata(Test)
write.beast(p,file = "Trytree.tree")
However it seems that figtree doesn't take my specified colors (it's using a default pallete). It was something that I did wrong?