etetoolkit / ete

Python package for building, comparing, annotating, manipulating and visualising trees. It provides a comprehensive API and a collection of command line tools, including utilities to work with the NCBI taxonomy tree.
http://etetoolkit.org
GNU General Public License v3.0
768 stars 216 forks source link

How to add text descriptors to highlighted regions in the circular graph? #83

Closed tlnagy closed 10 years ago

tlnagy commented 10 years ago

I have a graphic that is very dense and it's hard to distinguish between the leaves so I wanted to label over each colored region to indicate what they are:

test2

How could I do this? I would prefer to label over the individual regions themselves, but a legend would work as well. I'm coloring the regions using NodeStyle's background color property.

Thanks for the help! -t

jhcepas commented 10 years ago

Hi Tamas,

region labels are not implemented yet, although the feature is in the roadmap for future versions.

Adding a legend is possible using the TreeStyle.legend, which is a FaceContainer object. You can use TreeStyle.add_face(...) and then place the full block in any of the four corners of the image (TreeStyle.legend_position).

Something like this: http://pythonhosted.org/ete2/tutorial/tutorial_drawing.html?highlight=legend#add-legend-and-title

cheers, jaime

PS. I am CCing this question to the support mailing list

Jaime Huerta-Cepas, Ph.D. Structural and Computational Biology Unit EMBL Heidelberg Meyerhofstraße 1, 69117 Heidelberg, Germany

http://www.bork.embl.de/~huerta/

2014-06-25 16:58 GMT+02:00 Tamas Nagy notifications@github.com:

I have a graphic that is very dense and it's hard to distinguish between the leaves so I wanted to label over each colored region to indicate what they are:

[image: test2] https://cloud.githubusercontent.com/assets/1661487/3386925/c21eaf24-fc78-11e3-9ec4-9b36fc9228ff.png

How could I do this? I would prefer to label over the individual regions themselves, but a legend would work as well. I'm coloring the regions using NodeStyle's background color property.

Thanks for the help! -t

— Reply to this email directly or view it on GitHub https://github.com/jhcepas/ete/issues/83.

tlnagy commented 10 years ago

Using a simple legend will work for now. Thanks!