Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAvoid labels intersecting segments #34
Comments
|
Thanks for opening this issue and including a figure that shows the problem. Indeed, the algorithm is using repulsive forces to push labels away from each other, and to push labels away from the labeled points. I might suggest using one of the existing functions in my code to compute the intersection between a rectangle and a line, and then repelling the rectangle away from this intersection point. There may be some unexpected consequences, but I think it's worth a try. I would be very happy to review a pull request that implements this feature. If you decide to do it, please include test cases that show off the new behavior. |
|
@erikor Could I please ask you to try the latest ggrepel 0.7.1 and let me know if it works better for cases where line segments are intersecting? @AliciaSchep implemented some new code and I have a feeling you might like the new behavior. devtools::install_github("slowkow/ggrepel@0.7.1")Hope it works! |
Would it be possible to avoid segments intersecting other labels as in this example:
It seems you are using a force directed layout, which IIRC does not really concern itself with the segments but only the nodes. One solution might be to ramp up the force when intersections are detected?
Detecting intersections for all labels may be just way too computationally expensive, so feel free to close issue if not feasible! (Thanks for fantastic package!)