Gal Horesh
Gal Horesh
Old thread, but was struggling with this today and figured it out. The colour order shouldn't be the reverse of `tree$tip.label`, but the reverse of `tree$tip.label[order.dendrogram(x = as.dendrogram(tree))]`
The details of the code are not so clear to me on a quick look, but I realised that the order of the lines came down to this [line](https://github.com/talgalili/dendextend/blob/4b8711c625fc9f208b12b93b73747f654f57b684/R/tanglegram.R#L1008). ```...
This should help: ``` library(ape) library(dendextend) library(phytools) tree1 = rtree(n = 20) tree2 = rtree(n = 20) ## the problem arises when you reroot the tree and the order changes...