Skip to content

Preserve units in guide packaging #6580

@teunbrand

Description

@teunbrand

In ggplot2, we cast all guide dimensions to centimetres, which may be detrimental for adaptive sizing needed for dynamically wrapped text for example.
It leads to a miscommunication of the guide's size, leading to awkward results.

library(ggplot2)

ggplot(mpg, aes(displ, hwy, colour = drv)) +
  geom_point() +
  scale_colour_discrete(
    name = textshaping::lorem_text(),
    guide = marquee::guide_marquee()
  ) +
  theme(panel.widths = unit(5, "cm"))
#> Warning in split.default(glyphs, rep(seq_len(n_breaks), each = n_layers)): data
#> length is not a multiple of split variable
#> Warning in max(unlist(width)): no non-missing arguments to max; returning -Inf
#> Warning in max(unlist(height)): no non-missing arguments to max; returning -Inf

Created on 2025-08-27 with reprex v2.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorguides 📏

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions