ete icon indicating copy to clipboard operation
ete copied to clipboard

Issues with Circular Layout

Open luederm opened this issue 4 years ago • 1 comments

Hello,

I am having a couple issues with the circular layout and I was wondering if there is a way around them.

Issue 1) Semicircle trees have lots of unnecessary whitespace This can be seen with the example from the tutorial

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)

temp As shown, there is a large amount of whitespace below the tree that could be cropped out. Is there a way to get rid of this?

Issue 2) Circular trees with fixed scale and variable face sizes place nodes unnecessary far from tree This can be seen in the tree below: example_tree Which was generated by the following code:

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
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)

The two large circles could be much closer to the tree. My guess is that, currently, collisions are detected as a 'cone' from the face to the tree branch. Is it possible to get the larger circles positioned closer to the tree? The whitespace issue is also shown in this example.

luederm avatar Sep 22 '21 19:09 luederm

thanks @luederm , our efforts are currently on the new smartview viz system in the ete4 branch. We can review and merge your PR for the upcoming ete4 release, though.

jhcepas avatar Dec 30 '21 15:12 jhcepas

Fixed with https://github.com/etetoolkit/ete/pull/569 . Thanks again, @luederm !

jordibc avatar Oct 03 '23 13:10 jordibc