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

limit mtree grid plotting to size of tree list, bypass div by zero error #84

Closed ryneches closed 2 months ago

ryneches commented 2 months ago

This PR handles a few minor edge cases.

Sometimes, the user may want to plot a grid of trees that doesn't neatly fill an out nrows by ncols grid. For such cases, I think it's fine to leave the last few cells of the grid empty.

Sometimes, when plotting unrooted trees, the tip label angle is (I think?) straight up and down. This results in a divide by zero error. Fortunately, we actually want to the arctangent of this particular infinity, so we can bypass the errror by using the asymptotic limit of arctangent for this special case.

ryneches commented 2 months ago

Now I can plot all my broken little gene trees!

77-849_gene_garden

eaton-lab commented 2 months ago

Brilliant. The first problem was on my TODO list, and the second I wasn't aware of. Thanks!