empress icon indicating copy to clipboard operation
empress copied to clipboard

SVG Export Improvements

Open ElDeveloper opened this issue 3 years ago • 4 comments

  • [ ] Add support to only export the tree that's currently visible on screen.
  • [ ] Change the dimensions of the page in the Python code (currently 4020x4020) which makes the size of the SVG document far too large.
  • [x] Add support to export barplots, and their legends (once #293 is merged).
  • [x] Add support to export collapsed clades.

Anything else you can think of @sjanssen2?

ElDeveloper avatar Aug 05 '20 18:08 ElDeveloper

  1. we might want to think about the dimension and position of the legends. They are currently positioned at (0,0) and have a fixed size (relative to one hard coded variable). It might be more elegant to re-size according to drawing area.
  2. we discussed to replace the 15 line arc by one real arc for the circular layout, however, this would mean some extra math that can be messed up + intelligent traversal to differentiate between arc lines and "normal" edges
  3. shall we aim to write node names into SVG tags or would that bloat the file too much?

sjanssen2 avatar Aug 05 '20 19:08 sjanssen2

Regarding labeling nodes, maybe we would want to think about showing labels for some nodes and just displaying those instead. But that sounds like something outside of the scope of SVG export 😄

ElDeveloper avatar Aug 05 '20 23:08 ElDeveloper

a few things we should fix at some point:

  • [ ] Rather than checking node color to determine whether or not to thicken the line of certain nodes, we should check the isColored property of the corresponding node. This is because it's totally possible for a node to get assigned the exact default color but still be technically "colored," and therefore drawn in the Empress UI with extra thickness (I doubt this is the case with any of the current color maps, but it's still a possibility ...)

    • I understand that currently exportSvg() works on a line-by-line basis (so it doesn't "know" which lines are associated with which nodes), but it should be possible to make this work by replicating some of the work done in getCoords() (and/or having getCoords() return some sort of structure mapping nodes to line positions in coords or something).
  • [ ] Line width scaling changed with #275, and I forgot to update the SVG export code (sorry). We should fix this -- although a challenge is that the SVG stroke width isn't really comparable to the line widths the code currently uses (i.e. for us the default line width is now 0, but setting a stroke width of 0 will probably cause nothing to be drawn).

Since both of these seem like fairly annoying issues to resolve, it may be reasonable to just not alter line thickness when exporting SVG images of the tree for the time being.

fedarko avatar Aug 15 '20 23:08 fedarko

  • [ ] Configurable dimensions in the exported image (e.g. fit to letter paper)
  • [ ] Figure out why text styles are not applied to legend SVG in GIMP

fedarko avatar Sep 22 '20 21:09 fedarko