Dear Liam, Many thanks for your answer! Especially for making a blog post about it.
Cheers! Pedro ----- Dr. Pedro P. G. Taucce Postdoctoral Researcher (CNPq - PDJ) National Institute of Amazonian Research (INPA) Av. André Araújo 2936, Petrópolis CEP 69.067-375 Manaus, AM www.pedrotaucce.org Lattes <http://lattes.cnpq.br/6010051338306653> | LinkedIn <http://linkedin.com/in/pedrotaucce> | ResearchGate <https://www.researchgate.net/profile/Pedro-Taucce> Associate Editor, *The Herpetological Journal <https://www.thebhs.org/publications/the-herpetological-journal>* Subject Editor, *Zoosystematics and Evolution <https://zse.pensoft.net/>* Subject Editor, *Neotropical Biology and Conservation <https://neotropical.pensoft.net/>* Em sex., 11 de ago. de 2023 às 18:07, Liam J. Revell <liam.rev...@umb.edu> escreveu: > Dear Pedro. > > The common way to accomplish this is using *ape::nodelabels*; however, in > Chapter 13 of my recent book > <https://press.princeton.edu/books/phylogenetic-comparative-methods-in-r> > with Luke Harmon we show how to code it yourself pretty easily. I also just > posted a solution that you might find useful on my blog: > http://blog.phytools.org/2023/08/coloring-nodes-by-bootstrap-or-bayesian.html > . > > All the best, Liam > Liam J. Revell > Professor of Biology, University of Massachusetts Boston > Web: http://faculty.umb.edu/liam.revell/ > Book: Phylogenetic Comparative Methods in R > <https://press.princeton.edu/books/phylogenetic-comparative-methods-in-r> > (*Princeton University Press*, 2022) > > > On 8/10/2023 11:11 AM, Pedro Taucce wrote: > > [You don't often get email from pedrotau...@gmail.com. Learn why this is > important at https://aka.ms/LearnAboutSenderIdentification ] > > CAUTION: EXTERNAL SENDER > > Dear all, > > I want to plot an ultrametric BEAST2 tree with circles in the nodes colored > by posterior probability: > 0.95 black, between 0.5 and 0.95 gray and 0.5 > and below no circle (or white). Is that possible? I have tried several > packages and solutions and the more close solution I figured out is: > > # Load the required libraries > library(treeio) > library(phytools) > > # Set the working directory > setwd("~/Documents/Anolis_Ana/BEAST2/") > > # Read the tree from the file > my_tree <- read.beast("anolis_ND2.tre") > posterior <- my_tree$posterior > > # Define colors based on posterior probabilities > colors <- ifelse(posterior > 0.95, "black", > ifelse(posterior > 0.5, "darkgray", "white")) > # Assign colors to tree nodes > my_tree$node.color <- colors > > # Plot the tree with custom node colors > plot(my_tree,direction="upwards",show.tip.label = F, node.color = colors) > > The problem is it colors the branches instead of the nodes. Any ideas? > > Thank you very much! > > Pedro > ----- > Dr. Pedro P. G. Taucce > Postdoctoral Researcher (CNPq - PDJ) > National Institute of Amazonian Research (INPA) > Av. André Araújo 2936, Petrópolis > CEP 69.067-375 Manaus, AM > https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.pedrotaucce.org%2F&data=05%7C01%7Cliam.revell%40umb.edu%7Cd65c877b851d40ebcea708db99b42869%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C638272771288736792%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=P4273mVj9v30a%2FCgXaxzQbjcWFPTxBrzTi1NwiA15Fo%3D&reserved=0 > <http://www.pedrotaucce.org/> > Lattes > <https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Flattes.cnpq.br%2F6010051338306653&data=05%7C01%7Cliam.revell%40umb.edu%7Cd65c877b851d40ebcea708db99b42869%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C638272771288736792%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=RZBm6B1xcicdK2RZuLCw9lSL7bmSfYeMwF7KaGNdCpI%3D&reserved=0> > <http://lattes.cnpq.br/6010051338306653> | > LinkedIn<https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Flinkedin.com%2Fin%2Fpedrotaucce&data=05%7C01%7Cliam.revell%40umb.edu%7Cd65c877b851d40ebcea708db99b42869%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C638272771288736792%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=dlz7BOc8Nqmc1Sew%2Fl4NT90BRkQ4YBEVRvQhz9uIK9U%3D&reserved=0> > <http://linkedin.com/in/pedrotaucce> | > ResearchGate<https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.researchgate.net%2Fprofile%2FPedro-Taucce&data=05%7C01%7Cliam.revell%40umb.edu%7Cd65c877b851d40ebcea708db99b42869%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C638272771288736792%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=ynRyUpu36xzQ943ylRXtMCbZF5aT%2Bo6%2F3tflcqCvK8M%3D&reserved=0> > <https://www.researchgate.net/profile/Pedro-Taucce> > > Associate Editor, *The Herpetological > Journal<https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.thebhs.org%2Fpublications%2Fthe-herpetological-journal&data=05%7C01%7Cliam.revell%40umb.edu%7Cd65c877b851d40ebcea708db99b42869%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C638272771288736792%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=9l9WR7MNJwPiC568MOc3EeXhLyvMS6%2BBNQL4JD8P%2BIk%3D&reserved=0> > <https://www.thebhs.org/publications/the-herpetological-journal>* > > Subject Editor, *Zoosystematics and Evolution > <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fzse.pensoft.net%2F&data=05%7C01%7Cliam.revell%40umb.edu%7Cd65c877b851d40ebcea708db99b42869%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C638272771288736792%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=oC6YJ6UTtkSeBXxAwFKp7W3%2BqrqW43Ad%2B3NS5dOkGFM%3D&reserved=0> > <https://zse.pensoft.net/>* > > Subject Editor, *Neotropical Biology and > Conservation<https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fneotropical.pensoft.net%2F&data=05%7C01%7Cliam.revell%40umb.edu%7Cd65c877b851d40ebcea708db99b42869%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C638272771288736792%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=m1rNKYIYpYl0NzVNBJAwAqmSv%2BQh%2F3TRj%2Fa0FRnXIEU%3D&reserved=0> > <https://neotropical.pensoft.net/>* > > [[alternative HTML version deleted]] > > _______________________________________________ > R-sig-phylo mailing list - > R-sig-phylo@r-project.orghttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-phylo&data=05%7C01%7Cliam.revell%40umb.edu%7Cd65c877b851d40ebcea708db99b42869%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C638272771288736792%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=lS%2BNW5z%2Bhrd9Mzos685C9Oyiri3dmUVuPry2zzUqKG8%3D&reserved=0 > <https://stat.ethz.ch/mailman/listinfo/r-sig-phylo> > Searchable archive at > https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.mail-archive.com%2Fr-sig-phylo%40r-project.org%2F&data=05%7C01%7Cliam.revell%40umb.edu%7Cd65c877b851d40ebcea708db99b42869%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C638272771288736792%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=V5ObkrArg5Ec5c3C4cyu%2FDAsUH4LFRlEZMGvZjK80wk%3D&reserved=0 > <http://www.mail-archive.com/r-sig-phylo@r-project.org/> > > [[alternative HTML version deleted]] _______________________________________________ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/