library("TreeTools", quietly = TRUE)
# Generate some trees with a rogue taxon
trees <- AddTipEverywhere(BalancedTree(8), "Rogue")[3:6]
# Display the strict consensus
plot(consensus(trees), tip.col = ColByStability(trees))
# Add a legend for the colour scale used
PlotTools::SpectrumLegend(
"bottomleft", bty = "n", # No box
legend = c("Unstable", "", "Stable"),
palette = hcl.colors(131, "inferno")[1:101]
)
# Calculate leaf stability
instab <- TipInstability(trees, log = FALSE, ave = "mean", dev = "mad")
# Plot a consensus that omits the least stable leaves
plot(ConsensusWithout(trees, names(instab[instab > 0.2])))
Run the code above in your browser using DataLab