Circular tree branch distance

37 views
Skip to first unread message

rjpa...@gmail.com

unread,
May 21, 2012, 1:58:52 PM5/21/12
to The ETE toolkit
Hello,

I'm trying to render a circular tree on a reasonable large data set
(>500 items). Now, when drawing a circular tree, I fail to understand
how ETE determines the length of individual branchelines, let alone
how to override/manipulate them. For example, see
https://docs.google.com/open?id=0B3CT_7L--ZyjeTdfWlF5OEtpb0U.

Now, there seems to be a lot of unnecessary spacing in the image close
to the leafs of the tree. Also, on the 'level' where most of the leafs
are located, there is still some further branching. Why does this
happen? How can one change it? I played around with the TreeStyle
module but didn't have much luck with it.

I'm rendering the tree without any support/distance values. Thanks for
any assistance.

t = Tree(newick, format = 8)
ts = TreeStyle()
ts.mode = 'c'
ts.arc_span = 180
ts.arc_start = 180
ts.show_leaf_name = False
ts.show_branch_length = False
ts.show_scale = False
ts.layout_fn = label_layout
ts.title.add_face(faces.TextFace(title, fsize=20), column=0)

Jaime Huerta Cepas

unread,
May 29, 2012, 4:46:47 AM5/29/12
to eteto...@googlegroups.com
This is a known issue in ETE 2.1. So far, the only way to avoid this effect is by manually increasing the branch scale factor. The optimal value will depend on your tree length and graphical layout, so you will need to try. To increase scale, you can either use this option: 

ts = TreeStyle()
ts.scale = 100    # pixels per branch unit

or this one: 

ts = TreeStyle()
ts.tree_width = 700    # pixels 

Both have the same effect, since "ts.tree_width" is used to calculate the scale if "ts.scale" is not set. 

I know this is a very annoying problem. I'm working on a patch that will transparently detect the optimal branch scale for any type of layout. It is very close to be finished, but not ready yet. I will keep you posted. 

Jaime
Reply all
Reply to author
Forward
0 new messages