-
Notifications
You must be signed in to change notification settings - Fork 6
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
Overlap with figure boarder #13
Comments
I am not able to reproduce an overlap with the border, do you have a way to get such a result? Regarding the margin between the text and the border I should probably add an option like that, but I would first like to understand how you got the overlapping with the border before fixing this. Also, I would not recommend setting margin>min_distance in most cases, so you could try changing that, and I will also add a comment about that in the docs. |
Thank you for the example! As you say there seems to be something strange happening when applying aspect equal, and I am not able to pinpoint what it is right away. I will look further into it as soon as possible. Meanwhile, you could try initializing the figure with a size matching your aspect ratio, for example:
I know this is not a good solution, so as mentioned I will look into it as soon as I can! |
Thankyou for your suggestion!! That has helped me produce the plots I needed to for the mean time! :) |
Hi again, I have made an update which no longer should require you to set the figsize to match the aspect ratio. Please let me know if you try it and it does not work as expected. |
This was clearly not solved by what I believed to be a fix, seem to be missing something about what happens when setting the aspect_ratio manually or plotting on an image, reopening until I have worked it out. |
Okay, now I believe this issue is finally solved, even though the aspect had been set the fig does not update automatically, meaning that it had to be redrawn without rendering to update. Now hopefully everything should work properly. |
When running textalloc with set x/y limits for a figure, the text will occasionally overlap with the boarder.
You can have the same thing happen when running the below example:
import matplotlib.pyplot as plt
import textalloc as ta
fig, ax = plt.subplots()
labelsE = [0,2]
labelsN= [0,2]
labels=['Sample Text 1','Sample Text 2']
#Set X limit
ax.set_xlim(0,2)
#Set Y limit
ax.set_ylim(0,2)
ta.allocate_text(fig,ax,labelsE,labelsN,
labels,
scatter_plot=ax.scatter(labelsE,labelsN, c='b',s=0),
max_distance=.6,
min_distance=.03,
margin=0.1,
linewidth=0.5,
textsize=6,
draw_all=True,
nbr_candidates=200,
avoid_label_lines_overlap=True)
Would it be possible to add an option to state a minimum offset from the plot board?
The text was updated successfully, but these errors were encountered: