-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behaviorthemes ๐wipwork in progresswork in progress
Description
The colorbar guide (guide_colourbar) converts units into cm and then uses them as mm. Reproducible example:
library(ggplot2)
p1 <- ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Petal.Width)) + geom_point() +
scale_color_distiller(name = "gap width = 1cm") +
theme(legend.spacing.x = grid::unit(1, "cm"),
legend.position = "top")
p2 <- ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Petal.Width)) + geom_point() +
scale_color_distiller(name = "gap width = 10cm") +
theme(legend.spacing.x = grid::unit(10, "cm"),
legend.position = "top")
p3 <- ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Petal.Width)) + geom_point() +
scale_color_distiller(name = "gap width = 50cm") +
theme(legend.spacing.x = grid::unit(50, "cm"),
legend.position = "top")
cowplot::plot_grid(p1, p2, p3, nrow = 1)
The problem exists for both legend.spacing.x and legend.spacing.y but cannot be shown for legend.spacing.y because of issue #2260, which has not yet been fixed for guide_colourbar.
The relevant lines in the code are here (convert legend.spacing.x and legend.spacing.y into cm) and here (use all widths and heights as mm values.)
Metadata
Metadata
Assignees
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behaviorthemes ๐wipwork in progresswork in progress
