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
Pull request #196 solves problems with justification and angle of rotation for the initial position, as seen passing to geom_text_repel()max.iter = 0. With the default for max.iter and angles near or equal to 45, 135, 225, or 315 degrees, in some cases repulsion fails to shift the labels and the segment sometimes is attached to the wrong side of the text. It also looks like padding is not being applied. I hope not to have broken this in #196.
@slowkow Looking at select_line_connection() the algorithm seems to assume that the text box has its edges vertical and horizontal. This could explain segments being attached to the wrong edge with rotation that is not close to a multiple of 90 degrees. To be able to get the other new features in a release to CRAN, it might be best to simply issue a warning (or error) when the value passed to angleis not a multiple of 90 degrees.
In the long run, as 'grid' (>= 4.1.0) supports the use of grobs as masks, drawing segments always from the point to the centroid of the text box and then limiting the visible part with a mask could be a good solution.
@aphalo Agree! A warning is sufficient for now — could I please ask if you could update your pull request to include the warning? I feel like these issues are related.
I think the behavior we had before select_line_connection() might have been ok for rotated labels ... but I have not tested this. If it was ok, then maybe an if-statement can check for multiples of 90 and switch between the two.
Summary
Pull request #196 solves problems with justification and angle of rotation for the initial position, as seen passing to
geom_text_repel()
max.iter = 0
. With the default formax.iter
and angles near or equal to 45, 135, 225, or 315 degrees, in some cases repulsion fails to shift the labels and the segment sometimes is attached to the wrong side of the text. It also looks like padding is not being applied. I hope not to have broken this in #196.Minimal code example
Created on 2021-11-11 by the reprex package (v2.0.1)
Session info
The text was updated successfully, but these errors were encountered: