-
Notifications
You must be signed in to change notification settings - Fork 94
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
Rotate/extend label radius to prevent overlaps #459
Comments
I fear this is not easily possible. The rotation of the labels is fixed by Alternatively you can obtain the underlying Matplotlib labels = [artist for artist in ax.get_children() if isinstance(artist, Text)] Note that this list will also contain the label for the plasmid name and that each feature label is separated into multiple |
Thank you for the quick response @padix-key I found a package to adjust labels: https://github.com/Phlya/adjustText |
You could play with the |
I'm also running into this issue, and have a couple of suggestions, at least one of which I hope might be feasible.
Alternatively, what I've seen elsewhere for features that are too small to support labeling directly is to produce callouts with labels. I'm not sufficiently expert in matplotlib to do that myself, but it seems tractable. |
The length of a feature is proportional to the angle the feature indicator comprises. However, the angle, the feature label requires, depends on the radius from the center, i.e. on the track itself. For example, if you push a feature indicator onto a more central track, the label angle increases and hence might now overlap with another feature. So this unfortunately becomes a non-trivial optimization problem, if I am not wrong. As alternative we could push an indicator onto higher tracks until the label fits, but this might lead to highly suboptimal feature placements, as much more tracks may be occupied. Would this be a viable solution?
I think this might be a doable solution, although the placement might be a problem in this case. The positions of annotations in Matploltlib cannot be automized, as the attempt of implemeting this were fruitless (matplotlib/matplotlib#1313). However, if we would find dedicated positions for such labels this could work. Another possibility would be some kind of footnote for oversized labels. |
Hi,
Thank you for this amazing module, It helped me a lot in learning about plasmids.
I am trying to plot a plasmid map, and have a query regarding the same.
Is there any parameter to rotate or increase the radius of labels to prevent overlaps as seen in the figure?
I tried almost all matplotlib parameters nothing seems to affect the alignment:
I know there is a switch
omit_oversized_labels
to hide the oversized ones, but I need all labels to be visible.Thanks in advance.
The text was updated successfully, but these errors were encountered: