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

bins argument of geom_histogram and stat_bin argument off by 1 #1487

Closed
alistaire47 opened this Issue Jan 13, 2016 · 0 comments

Comments

Projects
None yet
2 participants
@alistaire47
Contributor

alistaire47 commented Jan 13, 2016

When looking at this SO question, I realized that when I set the bins argument of geom_histogram or stat_bin, the resulting histogram has one more bin than the argument. For example:

ggplot(data = iris, aes(x = Sepal.Length)) + stat_bin(bins = 3)

produces
histogram with four bins

which certainly doesn't seem like what most people would expect. Is this a zero-based index issue?

Apologies if I'm missing something obvious, and thanks for all your work.

@hadley hadley added the bug label Jan 25, 2016

@hadley hadley added this to the v2.1.0 milestone Jan 25, 2016

@hadley hadley closed this in 271a3e2 Jan 25, 2016

@lock lock bot locked as resolved and limited conversation to collaborators Jun 19, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.