Skip to content

Fix binned scaled not accepting function-limits if there are transformations #6145

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

Merged
merged 3 commits into from
Oct 28, 2024

Conversation

teunbrand
Copy link
Collaborator

@teunbrand teunbrand commented Oct 18, 2024

This PR aims to fix #6144.

It simply doesn't attempt to pre-transform the limits when the limits is a function.

Reprex from issue:

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

df <- data.frame(x = seq(as.Date("2024-01-01"), as.Date("2024-06-30"), "day"))

ggplot(df) +
  geom_bar(aes(x)) +
  scale_x_binned(
    breaks = scales::breaks_width("1 month"),
    transform = scales::transform_date(),
    limits = function(x) { x }
  )
#> Warning in scale_x_binned(breaks = scales::breaks_width("1 month"), transform = scales::transform_date(), : Ignoring `n.breaks`. Use a breaks function that supports setting number of
#> breaks.

Created on 2024-10-18 with reprex v2.1.1

The spurious warning the scale throws is commented upon here as well and better fixed in that PR than this PR.

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 teunbrand merged commit b174986 into tidyverse:main Oct 28, 2024
13 checks passed
@teunbrand teunbrand deleted the fix_6144 branch October 28, 2024 14:50
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 don't work with limits = function()
2 participants