eaton-lab / toytree

A minimalist tree plotting library using toyplot graphs
http://eaton-lab.org/toytree
BSD 3-Clause "New" or "Revised" License
164 stars 28 forks source link

Long labels partially displayed #77

Closed chtate closed 10 months ago

chtate commented 10 months ago

Hi !

Thank you for this helpful package. We are currently using your code to facilitate the entry of sequencing results from hospital patients. More exactly, we are using the visualization part from an existing newick tree, and saving the result as a PDF file. Unfortunately, in the resulting image, some labels are not complete (cut around the 35th character). We couldn't find in the documentation a way to increase the label part (because the global width can be increased, but it seems to zoom only on the tree, and reduce the labels size, isn't it ?). We have found a solution to retrieve the missing part of the label by saving it in the SVG format (increase the size of the background and save it to a PDF), but as we are dealing with a huge number of tree each week, a manual solution is not possible. Do you have an idea, or missing properties that we have missed to set this problem ?

If you need any example, I can send you one of our PDF file.

Thank you for your help, and for you work.

eaton-lab commented 10 months ago

Hi @chtate ,

This has been a consistent problem that derives from a bug in toyplot. I hope to have a full solution some day, but in the mean time I have only a hack solution implemented in the .draw parameter 'shrink'. See here: https://toytree.readthedocs.io/en/latest/Cookbook.html?highlight=shrink#2.-Spacing-tree-vs.-tip-names

BTW: the toytree v3 update will arrive very soon. It does not fix this problem, but has many other new improvements.

Best, Deren

chtate commented 10 months ago

Thank you Deren,

It will perfectly suit us. Sorry, I didn't found by myself that useful part in the documentation...