Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: rotated text in guide_colourbar() #5455

Closed
teunbrand opened this issue Oct 5, 2023 · 1 comment · Fixed by #5456
Closed

Bug: rotated text in guide_colourbar() #5455

teunbrand opened this issue Oct 5, 2023 · 1 comment · Fixed by #5456
Labels
bug an unexpected problem or unintended behavior guides 📏

Comments

@teunbrand
Copy link
Collaborator

In current main branch, when using rotated legend text with vjust = 1, the text starts overlapping the colourbar itself.
In the example below, I expected the left-most 'C' to start at the right of the colourbar.

devtools::load_all("~/packages/ggplot2/")
#> ℹ Loading ggplot2

ggplot(mpg, aes(displ, hwy)) +
  geom_point(aes(colour = cty)) +
  scale_colour_continuous(
    breaks = c(10, 20, 30),
    labels = c("A", "B\nB", "C\nC\nC")
  ) +
  theme(
    legend.text = element_text(angle = 270, vjust = 1)
  )

Created on 2023-10-05 with reprex v2.0.2

@teunbrand teunbrand added bug an unexpected problem or unintended behavior guides 📏 labels Oct 13, 2023
@teunbrand
Copy link
Collaborator Author

Same issue for guide_bins()

devtools::load_all("~/packages/ggplot2/")
#> ℹ Loading ggplot2

ggplot(mpg, aes(displ, hwy)) +
  geom_point(aes(size = cty)) +
  scale_size_continuous(
    breaks = c(10, 20, 30),
    labels = c("A", "B\nB", "C\nC\nC"),
    guide  = "bins"
  ) +
  theme(
    legend.text = element_text(angle = 270, vjust = 1)
  )

Created on 2023-11-08 with reprex v2.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior guides 📏
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant