Hi, and thanks for the great package.
I have a question about the spacing between the beginning of the segment and the text label. Right now, there seems to be an invisible fixed gap between the label and the point where the segment starts. This creates a noticeable amount of white space, and I would like the segment to begin much closer to the label text.
I’ve attached a sketch to illustrate the idea:
- The orange box represents the invisible padding I want to remove.
- The purple arrows/segments show the desired behavior: the segment should start almost flush with the label.
I initially thought this was controlled by box.padding, but that only affects the repulsion behavior, not the distance between the label and the segment start.
Looking at the source code, it seems this spacing might be hard‑coded here:
|
# Get the coordinates of the intersection between the line from the |
|
# original data point to the centroid and the rectangle's edges. |
|
extra_padding_x <- convertWidth(unit(0.25, "lines"), "native", TRUE) / 2 |
|
extra_padding_y <- convertHeight(unit(0.25, "lines"), "native", TRUE) / 2 |
|
text_box <- c( |
|
x1 - extra_padding_x, y1 - extra_padding_y, |
|
x2 + extra_padding_x, y2 + extra_padding_y |
|
) |
|
#int <- intersect_line_rectangle(point_pos, center, text_box) |
|
int <- select_line_connection(point_pos, text_box) |
Would it be possible to expose this as an argument (e.g., something like segment.padding)? This would allow finer control over the appearance of label–segment connections, especially in dense plots or when using small plot dimensions.
Thanks for considering this — and for maintaining such a useful package.
Hi, and thanks for the great package.
I have a question about the spacing between the beginning of the segment and the text label. Right now, there seems to be an invisible fixed gap between the label and the point where the segment starts. This creates a noticeable amount of white space, and I would like the segment to begin much closer to the label text.
I’ve attached a sketch to illustrate the idea:
I initially thought this was controlled by
box.padding, but that only affects the repulsion behavior, not the distance between the label and the segment start.Looking at the source code, it seems this spacing might be hard‑coded here:
ggrepel/R/geom-text-repel.R
Lines 623 to 632 in b07305d
Would it be possible to expose this as an argument (e.g., something like
segment.padding)? This would allow finer control over the appearance of label–segment connections, especially in dense plots or when using small plot dimensions.Thanks for considering this — and for maintaining such a useful package.