Closed
Description
Hi! I've noticed an annoying bug.
When data contains enough variance to plot all breaks, scale_fill_steps2()
works as expected.
library(ggplot2)
data <- data.frame(x = 1:3)
ggplot(data) + geom_col(aes(x, x, fill = x)) + scale_fill_steps2(breaks = 1:3, labels = 1:3)
However, when number of breaks exceeds the number of unique oobservations, the function fails:
library(ggplot2)
data <- data.frame(x = 1:2)
ggplot(data) + geom_col(aes(x, x, fill = x)) + scale_fill_steps2(breaks = 1:3, labels = 1:3)
#> Error in `scale_fill_steps2()`:
#> ! `breaks` and `labels` have different lengths.
Could this be linked to #4548 ?