Skip to content

Commit

Permalink
Bug-fix justification with angle in geom_label() (#5424)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
aphalo authored Oct 4, 2023
1 parent a560c99 commit 182405b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/geom-label.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ GeomLabel <- ggproto("GeomLabel", Geom,

data <- coord$transform(data, panel_params)
if (is.character(data$vjust)) {
data$vjust <- compute_just(data$vjust, data$y)
data$vjust <- compute_just(data$vjust, data$y, data$x, data$angle)
}
if (is.character(data$hjust)) {
data$hjust <- compute_just(data$hjust, data$x)
data$hjust <- compute_just(data$hjust, data$x, data$y, data$angle)
}
if (!inherits(label.padding, "margin")) {
label.padding <- rep(label.padding, length.out = 4)
Expand Down

0 comments on commit 182405b

Please sign in to comment.