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

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

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.

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()
1 participant