-
Notifications
You must be signed in to change notification settings - Fork 2.1k
stat_summary_bin bug? #1739
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
Comments
Possible duplicate of #1651 |
Simpler reprex: library(ggplot2)
x <- seq(0, 1, length = 1e2)
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.y=mean, bins=10, geom = "point", colour = "red")
# OK
ggplot(dt, aes(x)) +
geom_histogram(bins = 10, boundary = 0) |
That's not an NA bin, it's the bin |
Thanks Hadley. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Uh oh!
There was an error while loading. Please reload this page.
In the plot below, you can see that an "extra" bin value is plotted to the right of the data values.
It seems like there could be a bug in
stat_summary_bin
, because, as shown in the code below, two y values (from the two rows with the highest x-values) are excluded from the binning and end up in anNA
bin, which is the one plotted to the right of the data bins in the plot above. I would have expected that by default ggplot would include all the data values in the binning procedure.The issue raised above is based on this SO question.
The text was updated successfully, but these errors were encountered: