You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Would be nice if SVG trees could have the tip labels rotated by 90 degrees #26
At the moment, for large trees with custom labels, labels from SparseTree.draw(format="svg") are bound to overlap. An option to rotate the labels by 90 degrees would be helpful, and probably very easy to code.
The only tricky issue with this is the overall spacing. The bottom padding would need to be tweaked to allow space for the labels, which means we'd need some way to measure the size of the labels. AFAICT, this is impossible in SVG.
Possibly the simplest option is to have a y_padding=(bottom, top) argument which can be tweaked by the user. We need something like this anyway for some labels, as they are not being rendered correctly with some font sizes, etc.
For a rough first pass I think you could not bother accommodating label space, and simply allow users to re-frame the svg after the fact, which I know is easy in e.g. inkscape. After all, the information is all there, just not visible until you re-frame. A bit yucky, but a usable solution.
To reframe using inkscape so that everything is in the canvas, you can do inkscape --verb=FitCanvasToDrawing --verb=FileSave --verb=FileClose *.svg, but this is admittedly a hacky solution.
Activity
jeromekelleher commentedon May 31, 2018
The only tricky issue with this is the overall spacing. The bottom padding would need to be tweaked to allow space for the labels, which means we'd need some way to measure the size of the labels. AFAICT, this is impossible in SVG.
Possibly the simplest option is to have a y_padding=(bottom, top) argument which can be tweaked by the user. We need something like this anyway for some labels, as they are not being rendered correctly with some font sizes, etc.
hyanwong commentedon May 31, 2018
For a rough first pass I think you could not bother accommodating label space, and simply allow users to re-frame the svg after the fact, which I know is easy in e.g. inkscape. After all, the information is all there, just not visible until you re-frame. A bit yucky, but a usable solution.
hyanwong commentedon May 31, 2018
Just to note, this requires using the transform mixin for svgwrite, http://svgwrite.readthedocs.io/en/latest/classes/mixins.html#transform-mixin. To reframe using inkscape so that everything is in the canvas, you can do
inkscape --verb=FitCanvasToDrawing --verb=FileSave --verb=FileClose *.svg, but this is admittedly a hacky solution.jeromekelleher commentedon May 31, 2018
Good to know, thanks.
hyanwong commentedon May 7, 2020
We can now do this via SVG styles (
text {transform: rotate(90deg)}), and #589 would deal with the padding issue, so I'm closing this.