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
We've run into problems with short tracks near the left or right edges. If the label is longer than the track rectangle, then the label text can flow past the edge of the diagram.
Here's an example, including our current workaround:
from genetracks import Figure, Track, Multitrack
f = Figure()
f.add(Track(1, 1500, label='Track with a long contig'))
# The problem
f.add(Track(1, 150, label='Track with a long name'))
# A workaround
f.add(Multitrack([Track(1, 150),
Track(1,
1500,
label='Short track with centred name',
color='none')]))
f.show(w=900).saveSvg("alignment.svg")
Here's how it looks:
I thought it might be helpful to set the text-anchor attribute of the labels. I don't think there's a good way to estimate the width of the text, so the best I could think of was to use start when the track starts on the left third of the diagram, middle when it starts in the middle third, and end when it starts on the right third.
If you think that's a reasonable approach, I can prepare a pull request.
The text was updated successfully, but these errors were encountered:
We've run into problems with short tracks near the left or right edges. If the label is longer than the track rectangle, then the label text can flow past the edge of the diagram.
Here's an example, including our current workaround:
Here's how it looks:
I thought it might be helpful to set the
text-anchor
attribute of the labels. I don't think there's a good way to estimate the width of the text, so the best I could think of was to usestart
when the track starts on the left third of the diagram,middle
when it starts in the middle third, andend
when it starts on the right third.If you think that's a reasonable approach, I can prepare a pull request.
The text was updated successfully, but these errors were encountered: