How to colour the branches of an unrooted tree using a variable in R
问题 I would like to generated unrooted neighbour joining trees from input haplotype data, and then colour the branches of the trees based on a variable. I am using the packages Ape and ggtree. The haplotypes and co-variables (metadata) are on two separate files with matching sample names. I have been able to produce trees and colour the tips of the trees by variables, but not the tree branches. Using mock data - # Packages library('ggplot2') library('ape') library('phangorn') library('dplyr')