Skip to content

Commit 182405b

Browse files
authored
Bug-fix justification with angle in geom_label() (#5424)
Now that geom_label() supports rotation with angle, it is necessary to pass the angle as the third argument to compute_just() as it is done in geom_text() to ensure correct text justification.
1 parent a560c99 commit 182405b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

R/geom-label.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ GeomLabel <- ggproto("GeomLabel", Geom,
7474

7575
data <- coord$transform(data, panel_params)
7676
if (is.character(data$vjust)) {
77-
data$vjust <- compute_just(data$vjust, data$y)
77+
data$vjust <- compute_just(data$vjust, data$y, data$x, data$angle)
7878
}
7979
if (is.character(data$hjust)) {
80-
data$hjust <- compute_just(data$hjust, data$x)
80+
data$hjust <- compute_just(data$hjust, data$x, data$y, data$angle)
8181
}
8282
if (!inherits(label.padding, "margin")) {
8383
label.padding <- rep(label.padding, length.out = 4)

0 commit comments

Comments
 (0)