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 limits and reverse transform #5357

Merged
merged 5 commits into from
Aug 1, 2023

Conversation

teunbrand
Copy link
Collaborator

This PR aims to fix #5355.

Briefly, it now accepts NA in the limits to fill in the 'natural' limits, by using the continuous scale's get_limits(). Also, it tracks if limits have been supplied in reverse order and handles breaks correspondingly.

Small demo:

devtools::load_all("~/packages/ggplot2")
#> ℹ Loading ggplot2
library(patchwork)

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

p1 <- p + scale_x_binned()
p2 <- p + scale_x_binned(
  trans = "reverse", 
  right = FALSE # Just to be symmetrical with p1
) 

p1 | p2

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

Copy link
Member

@thomasp85 thomasp85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@teunbrand
Copy link
Collaborator Author

Thanks for the review!

@teunbrand teunbrand merged commit cd7199d into tidyverse:main Aug 1, 2023
12 checks passed
@teunbrand teunbrand deleted the binned_limits branch August 1, 2023 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Binned scales do not works with NA limits and cannot be reversed.
2 participants