ete
ete copied to clipboard
Resolve #568
Resolves #568. Changes:
- Remove excess whitespace in semicircle layouts.
from ete3 import Tree, TreeStyle
t = Tree()
t.populate(30)
ts = TreeStyle()
ts.show_leaf_name = True
ts.mode = "c"
ts.arc_start = -180 # 0 degrees = 3 o'clock
ts.arc_span = 180
t.render('example.png', tree_style=ts)
- Added ability to bring leaf nodes closer to center in circular layouts by reducing the length of each leaf's extra branch line as much as possible while avoiding intersecting QGraphicsItems. The 'pack_leaves' parameter in TreeStyle is used to turn this feature on.
from ete3 import Tree, TreeStyle, CircleFace
t = Tree()
t.populate(15)
ts = TreeStyle()
ts.scale = 100
ts.show_leaf_name = False
ts.mode = 'c'
ts.arc_start = -45
ts.arc_span = 90
ts.force_topology = True
ts.pack_leaves = True
node_sizes = [25, 25, 150, 25, 25, 25, 25, 25, 25, 25, 25, 150, 25, 25, 25]
for i, node in enumerate(t.iter_leaves()):
node.add_face(CircleFace(node_sizes[i], 'Red'), column=0, position='branch-right')
t.render('example.png', tree_style=ts)