Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scale_x_steps2() throws an error when labels and breaks are manually specified #6054

Open
EBukin opened this issue Aug 21, 2024 · 1 comment · May be fixed by #6061
Open

scale_x_steps2() throws an error when labels and breaks are manually specified #6054

EBukin opened this issue Aug 21, 2024 · 1 comment · May be fixed by #6061

Comments

@EBukin
Copy link

EBukin commented Aug 21, 2024

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 ?

@teunbrand
Copy link
Collaborator

Thanks for the report! I can reproduce the issue on my end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants