Preserve units in guide packaging
Closed this issue · 0 comments
teunbrand commented
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 -InfCreated on 2025-08-27 with reprex v2.1.1
