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

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

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

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

alistaire47 opened this issue Jan 13, 2016 · 0 comments
Labels
bug an unexpected problem or unintended behavior
Milestone

Comments

@alistaire47
Copy link
Contributor

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 an unexpected problem or unintended behavior label Jan 25, 2016
@hadley hadley added this to the v2.1.0 milestone Jan 25, 2016
@hadley hadley closed this as completed 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.
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants