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

Binned scales do not works with NA limits and cannot be reversed. #5355

Closed
teunbrand opened this issue Jul 19, 2023 · 0 comments · Fixed by #5357
Closed

Binned scales do not works with NA limits and cannot be reversed. #5355

teunbrand opened this issue Jul 19, 2023 · 0 comments · Fixed by #5357

Comments

@teunbrand
Copy link
Collaborator

I apologise for posting two problems in the same issue.

Binned scales cannot be reversed, as reported in r-lib/scales#389.
I expected these scales to be reversible.

library(ggplot2)

p <- ggplot(mtcars) + geom_bar(aes(mpg))

p + scale_x_binned(trans = "reverse")

Moreover, binned scales don't follow the convention where you can set one of the limits to NA to take the 'natural' limit of the data.
I expect this scale to start at 10 and not throw errors.

p + scale_x_binned(limits = c(10, NA))
#> Error in if (zero_range(range)) zero_width else diff(range): missing value where TRUE/FALSE needed

Created on 2023-07-19 with reprex v2.0.2

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.

1 participant