Skip to content
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

How to stop crossing/overlapping lines? #20

Closed
olgabot opened this issue Feb 1, 2017 · 2 comments
Closed

How to stop crossing/overlapping lines? #20

olgabot opened this issue Feb 1, 2017 · 2 comments

Comments

@olgabot
Copy link

olgabot commented Feb 1, 2017

Thank you for this package! It's very helpful to label a complicated plot.

I have a PCA plot that I'd like to annotate with the labels, and no matter what I do, the lines always end up crossing:

image

Two questions:

  1. Is there a flag or parameter that can be used to prevent the lines from crossing?
  2. Is there a flag or parameter to ensure that the labels are always "outward" from the data, i.e. pushed out using a unit circle from the middle of the plot?

Thanks!
Olga

@Phlya
Copy link
Owner

Phlya commented Feb 1, 2017

Hi Olga, thanks for your interest!

  1. No, sorry, this is not implemented and I don't know how to do this, but will be very happy to consider a PR. In your case, I would try reducing the repelling forces to make texts adjust slower, in the end it often looks less messy then.
  2. No, but if you would be fine with using a rectangle, and not a circle, you could try adding an invisible one to the area you want the labels to avoid, and add it via adjust_text(..., add_objects=[obj]) - any object that has a .get_window_extent() method should work (since I use bounding boxes to calculate overlaps, I'm limited to rectangles).

Please let me know if this helps, or if you have any other questions!

Ilya

@Phlya
Copy link
Owner

Phlya commented Apr 23, 2017

It's been a while, so closing.

@Phlya Phlya closed this as completed Apr 23, 2017
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