Skip to content

Would be nice if SVG trees could have the tip labels rotated by 90 degrees #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hyanwong opened this issue May 30, 2018 · 5 comments
Closed

Comments

@hyanwong
Copy link
Member

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.

@jeromekelleher
Copy link
Member

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
Copy link
Member Author

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
Copy link
Member Author

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
Copy link
Member

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.

Good to know, thanks.

@hyanwong
Copy link
Member Author

hyanwong commented 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.

@hyanwong hyanwong closed this as completed May 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants