empress
empress copied to clipboard
SVG Export Improvements
- [ ] 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?
- 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.
- 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
- shall we aim to write node names into SVG tags or would that bloat the file too much?
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 😄
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 ingetCoords()
(and/or havinggetCoords()
return some sort of structure mapping nodes to line positions incoords
or something).
- I understand that currently
-
[ ] 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 of0
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.
- [ ] 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