-
Notifications
You must be signed in to change notification settings - Fork 88
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
Unable to avoid text overlap each other even avoid_self = True #125
Comments
Difficult problem... Have you tried increasing |
It's been so long everything has changed now and hopefully works now? Feel free to reopen. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In many times, when we use matplotlib twinx to create two line in two axes but they share same x-axis, the first point and the last point may in the same position in figure coordinate.
If I want to annotate the start point and the end point, the annotation text will fully overlap. And the text should be repelled from the line to avoid overlap with the line too.
I found that in this situation, the adjust_text is unable to let the text separate.
Here is a simple demo. Very easy.
I have a repel function
get_line_repl_loc
to generate the interpolation point to repel text away from the lines.Here, first, we see the original plot:
Then, I plot the
xy_repls
by functionscatter
, we can see thexy_repls
are correct.Finally, use the
adjust_text
to move the text objects, with the limitation to be away from the line with dense point, avoid text itself and each otheravoid_self=True
andavoid_text=True
It seem the
adjust_text
did nothing.I visualise the operation of the
adjust_text
bysave_steps=True
. Here is the gifAutoalign separate the text each other, but the algorithm moves them closer and closer. Why? Or how to solve it?
If disable point repelling, it work well but just will overlap with the line instead of text each other.
adjust_text(text_list, avoid_self=True, avoid_text=True, save_steps=True)
I have try
expand_text
orforce_point
, both of them is useless, except that I add the text itself into theadd_objects
, but this kind of solution is meaningless.adjust_text(text_list, avoid_self=True, avoid_text=True, save_steps=True, add_objects=text_list)
This problem I have mention in #124 also.
So can owner gives some explanation or it just a bug?
Environment:
numpy version 1.21.2
matplotlib version 3.5.1
$ conda list | grep adjust
adjusttext 0.7.3.1 py_1 conda-forge
The text was updated successfully, but these errors were encountered: