Skip to content

Bug: rotated text in guide_colourbar() #5455

Closed

Description

@teunbrand

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

Activity

  1. added
    bug
    on Oct 13, 2023
  2. teunbrand commented on Nov 8, 2023

    @teunbrand
    CollaboratorAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugguides 📏

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions