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

Contour breaks function works in absence of bins and binwidth #5703

Merged
merged 4 commits into from
Mar 18, 2024

Conversation

teunbrand
Copy link
Collaborator

This PR aims to fix #5686.

Briefly, contour_breaks() will use a user-provided function even if bins and binwidth are NULL.
A missing binwidth argument is defaulted to 1/10th the available range.

Reprex from #5686:

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

ggplot(faithfuld, aes(waiting, eruptions, z = density)) +
  geom_contour(
    breaks = \(x, y) seq(x[1], x[2], length.out = 4)
  )

Created on 2024-02-23 with reprex v2.1.0

@teunbrand teunbrand added this to the ggplot2 3.5.1 milestone Mar 5, 2024
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.

Are there other binning stats where the old behaviour is present? I think it is important that we ensure all behaves similarly

@teunbrand
Copy link
Collaborator Author

I don't think so because it appears that other binning stats don't accept functions for the breaks argument, see also #4561.

@teunbrand teunbrand merged commit d05f8a4 into tidyverse:main Mar 18, 2024
12 checks passed
@teunbrand teunbrand deleted the contour_breaks_function branch March 18, 2024 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants