Skip to content

Using coord_radial(rotate_angle = TRUE) does not adjust justification. #5599

@teunbrand

Description

@teunbrand

In the plot below, all text labels should point inwards towards the middle. The labels that have flipped rotation do not have their justification flipped.

library(ggplot2)

ggplot(mtcars, aes(x = seq_along(disp), y = disp)) +
  geom_col() +
  geom_text(aes(y = Inf, label = rownames(mtcars)), hjust = 1, angle = 90) +
  coord_radial(rotate_angle = TRUE)

Created on 2023-12-18 with reprex v2.0.2

I think the lines below should gain some logic adjusting the text justification.

ggplot2/R/coord-radial.R

Lines 235 to 237 in a4be39d

if (self$rotate_angle && "angle" %in% names(data)) {
data$angle <- flip_text_angle(data$angle - rad2deg(data$theta))
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions