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
I have an example where the labels overlap even under a large number of iterations. It should be easy to find positions that do not overlap. I'm not quite sure why this isn't working. I would also suggest adding a warning if the algorithm cannot find label positions without overlaps.
Minimal code example
Here is the minimum amount of code neeeded to demonstrate the issue:
I am (sometimes) getting similar results. What works for me is the
adjustment of force (including force_pull in the development version) and
padding (point.padding, box.padding) parameters. Would it make sense to
have some auto-adjustment based on the number of overlaps as a stop
criterion? This could have an interface like `geom_label(force="auto")`?
@MFairley Thanks for pointing this out! I think the algorithm can certainly be improved to work for this particular case. Since the two labels at the top are at exactly the same y-axis position, they don't exert a force along the y-axis on each other.
One simple way to work around this would be to use "jittered" text label coordinates instead of exact coordinates when calculating forces inside ggrepel. That would eliminate the possibility for labels to be at exactly the same y-axis position.
Another problem is when a text label is surrounded from all sides by data points. The label can get stuck in the middle of the points instead of escaping to the outside of the point cloud.
@krassowski I'm open to any suggestions or ideas. By the way, I apologize for being slow with PRs and issues.
Summary
I have an example where the labels overlap even under a large number of iterations. It should be easy to find positions that do not overlap. I'm not quite sure why this isn't working. I would also suggest adding a warning if the algorithm cannot find label positions without overlaps.
Minimal code example
Here is the minimum amount of code neeeded to demonstrate the issue:
Here is an image of the output produced by the code:
Version information
Here is the output from
sessionInfo()
in my R session:The text was updated successfully, but these errors were encountered: