evolbioinfo / gotree

Gotree is a set of command line tools and an API to manipulate phylogenetic trees. It is implemented in Go language.
GNU General Public License v2.0
118 stars 15 forks source link

Added width and background options for svg and png #15

Open szufan opened 3 years ago

szufan commented 3 years ago

Hello -

I've noticed when writing trees to file with gotree draw svg and gotree draw png tip labels get cut off. I think, for SVG at least, this is because only +60 is added to the width (and height) parameters. This can be fixed by editing the svg attribute width="100%" or replacing width with overflow="visible". Could one of these be made default, or added as an option? This is also an issue with PNGs, but I do not have a workaround for that.

Another issue with PNGs is that the transparent background appears gray in Dark Mode. Could an option be added to create PNGs with a white background?

I tested the above with the following newick (sorry, .nwk not an accepted upload):

(long-label-20:0.0001775,(long-label-21:0,((long-label-12:0,long-label-13:0.000076,long-label-08:0,long-label-08-1:0,(long-label-09:0,really-long-label-11:0.000034):0.000069,long-label-07:0,long-label-19:0):0.000034,long-label-10:0,long-label-10-1:0,long-label-10-2:0,long-label-06:0,long-label-05:0,long-label-17:0,long-label-02:0,long-label-04:0,long-label-03:0,long-label-01:0):0.000102):0.0001775);

Using: gotree draw svg < in.nwk

gotree draw png < in.nwk

Thanks, Sara

fredericlemoine commented 3 years ago

Hello,

That is something I wanted to work on for a long time. The commits solve part of the drawing issues (especially with "normal" layout), but there are still work to do with circular and radial layouts.

Frédéric

szufan commented 3 years ago

Thank you @fredericlemoine ! Could you release this for conda users?

fredericlemoine commented 3 years ago

Sure, I will do it soon. In the mean time, you can also open your svg files with inkscape, and modify the dimension of the image.