Skip to content

Create the requested number of bins in bin2d_breaks() #4433

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 2 commits into from
Apr 21, 2021

Conversation

thomasp85
Copy link
Member

Fix #3824

This PR fixes the reported bug by removing the last bin if it lies completely outside the the scale range

@thomasp85 thomasp85 added this to the ggplot2 3.3.4 milestone Apr 19, 2021
Copy link
Member

@yutannihilation yutannihilation left a comment

Choose a reason for hiding this comment

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

Looks good.

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

x <- seq(0, 1, length = 1e4)
y <- x + rnorm(length(x))
dt <- data.frame(x, y)

# NOT OK
ggplot(dt, aes(x, y)) +
  geom_point(colour = "grey80") +
  stat_summary_bin(fun = mean, bins = 10, geom = "point", colour = "red")

Created on 2021-04-20 by the reprex package (v2.0.0)

@thomasp85 thomasp85 merged commit 20aa3ed into master Apr 21, 2021
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.

stat_summary_bin gives 1 bin more than specified.
2 participants