eaton-lab / toytree

A minimalist tree plotting library using toyplot graphs
http://eaton-lab.org/toytree
BSD 3-Clause "New" or "Revised" License
169 stars 28 forks source link

`draw()` arguments`fixed_order` and `tip_labels_colors` are mutually exclusive #45

Closed bede closed 3 years ago

bede commented 3 years ago

Thanks for developing Toytree! Since Toytree does not seem to have documented capabilities for reordering trees by branch length etc, it's useful to be able to supply a fixed order having done this using another library. Unfortunately I am unable to make fixed ordering work in conjunction with coloured tips. Is there a workaround? Coloured tips are IMO crucial for readability with aligned tip labels.

MWE:

import toytree
t = toytree.tree('((apple:2,orange:4)100:2,(((tomato:2,eggplant:1)100:2,pepper:3)90:1,tomatillo:2)100:1);')
order = ['tomato', 'eggplant', 'pepper', 'tomatillo', 'orange', 'apple']
t.draw(fixed_order=order, tip_labels_colors=[toytree.colors[i] for i, j in enumerate(order)])

Exception: AttributeError: 'ToyTree' object has no attribute '_fixed_idx'

eaton-lab commented 3 years ago

Thanks @bede , This is fixed and will work in the next versioned release.

bede commented 3 years ago

Amazing! Thanks @eaton-lab !