Closed as not planned
Description
I found a problem with the guide for a manual fill scale when a factor level is unused.
I expected the guide tile for group C to be green instead of transparent/grey.
Here is the code to reproduce the bug:
library(ggplot2)
data <- data.frame(
x = c(1, 2, 3, 4),
ymin = c(1, 1, 2, 2),
ymax = c(2, 2, 3, 3),
group = factor(c("A", "B", "A", "B"), levels = c("A", "B", "C"))
)
ggplot(data, aes(x = x, ymin = ymin, ymax = ymax, fill = group)) +
geom_ribbon() +
scale_fill_manual(
values = c("A" = "red", "B" = "blue", "C" = "green"),
limits = c("A", "B", "C"),
drop = FALSE
)
Created on 2024-11-25 with reprex v2.1.1
Metadata
Metadata
Assignees
Labels
No labels