legend?

474 views
Skip to first unread message

irina.n...@gmail.com

unread,
Jun 28, 2016, 5:50:16 PM6/28/16
to The ETE toolkit
Hi - I color coded this tree, but how do I add a legend to the picture? Thank you! Irina.



Auto Generated Inline Image 1

Jaime Huerta Cepas

unread,
Jun 28, 2016, 6:09:47 PM6/28/16
to eteto...@googlegroups.com
Hi Irina, 
- You can add a legend using TreeStyle:
TreeStyle.legend.add_face(CircleFace(10, "red"), column=0)
TreeStyle.legend.add_face(TextFace("0.5 support"), column=1)
http://etetoolkit.org/docs/latest/reference/reference_treeview.html#treestyle

- To avoid the the tip name being rendered twice, disable the default layout function. You can use this trick: 
TreeStyle.layout_fn = lambda node: True

- To collapse nodes, you can define your own strategy. Setting node size according to the number of tips collapsed is a good idea. 

Also, a few of tips regarding the use of the support mailing list: 1) please read the docs, examples, tutorials and previous questions before posting. Many problems have already been addressed. 2) for very general questions or ideas on how to use ETE, you can also use other forums like http://biostar.stackexchange.com/. There are way more users there, and the forum is more teaching oriented. 3) when posting here, try to condense all your questions in a single email rather than many consecutive messages. Keep in mind that your questions are arriving to hundred of other users and ETE developers.

I hope it helps, and thanks for using ETE!
-jaime  



On 28 June 2016 at 23:50, <irina.n...@gmail.com> wrote:
Hi - I color coded this tree, but how do I add a legend to the picture? Thank you! Irina.



--
You received this message because you are subscribed to the Google Groups "The ETE toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to etetoolkit+...@googlegroups.com.
To post to this group, send email to eteto...@googlegroups.com.
Visit this group at https://groups.google.com/group/etetoolkit.
For more options, visit https://groups.google.com/d/optout.

irina.n...@gmail.com

unread,
Jun 29, 2016, 10:52:34 AM6/29/16
to The ETE toolkit
Thank you. I saw these links. In my first post I did ask for a link to a complete documentation. I cannot find many things easily for ETE. Like how do you specify the position of the legend? I'm doing
ts.legend.add_face(RectFace(45,15,fgcolor = "None",bgcolor = "LightYellow",label = "15-20"), column=0). I don't see the label on the colored box. And if I add another one box with color, it appears next to it, not below it.

Another example -  I would never know about the rank_limit option in topology from your website documentation.

for layout_fn you say: Parameters:layout_fn (None) – Layout function used to dynamically control the aspect of nodes. Valid values are: None or a pointer to a method, function, etc.

What is etc?
How can I get from this that setting
lambda node: True is going to disable the node.name?

I've used networx, matplotlib, pygraphviz and those documentations are very detailed and I almost never need to ask the mailing lists at all. when I do, I usually get a response within minutes from many members, not just the author. I google and search a LOT before posting, but I don't see much about ETE on the other websites and I don't see a lot of the answers to very simple things in your docs.

You have very nice picures in ETE gallery, but it would be very helpfull to see example source code for them and also for how to place the legends.

Thank you,
Irina.
Reply all
Reply to author
Forward
0 new messages