{"action":"closed","issue":{"url":"https://api.github.com/repos/hadley/ggplot2/issues/1487","labels_url":"https://api.github.com/repos/hadley/ggplot2/issues/1487/labels{/name}","comments_url":"https://api.github.com/repos/hadley/ggplot2/issues/1487/comments","events_url":"https://api.github.com/repos/hadley/ggplot2/issues/1487/events","html_url":"https://github.com/hadley/ggplot2/issues/1487","id":126490943,"number":1487,"title":"bins argument of geom_histogram and stat_bin argument off by 1","user":{"login":"alistaire47","id":1693477,"avatar_url":"https://avatars.githubusercontent.com/u/1693477?v=3","gravatar_id":"","url":"https://api.github.com/users/alistaire47","html_url":"https://github.com/alistaire47","followers_url":"https://api.github.com/users/alistaire47/followers","following_url":"https://api.github.com/users/alistaire47/following{/other_user}","gists_url":"https://api.github.com/users/alistaire47/gists{/gist_id}","starred_url":"https://api.github.com/users/alistaire47/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alistaire47/subscriptions","organizations_url":"https://api.github.com/users/alistaire47/orgs","repos_url":"https://api.github.com/users/alistaire47/repos","events_url":"https://api.github.com/users/alistaire47/events{/privacy}","received_events_url":"https://api.github.com/users/alistaire47/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/hadley/ggplot2/labels/bug","name":"bug","color":"e02a2a"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/hadley/ggplot2/milestones/14","html_url":"https://github.com/hadley/ggplot2/milestones/v2.1.0","labels_url":"https://api.github.com/repos/hadley/ggplot2/milestones/14/labels","id":1461494,"number":14,"title":"v2.1.0","description":"","creator":{"login":"hadley","id":4196,"avatar_url":"https://avatars.githubusercontent.com/u/4196?v=3","gravatar_id":"","url":"https://api.github.com/users/hadley","html_url":"https://github.com/hadley","followers_url":"https://api.github.com/users/hadley/followers","following_url":"https://api.github.com/users/hadley/following{/other_user}","gists_url":"https://api.github.com/users/hadley/gists{/gist_id}","starred_url":"https://api.github.com/users/hadley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hadley/subscriptions","organizations_url":"https://api.github.com/users/hadley/orgs","repos_url":"https://api.github.com/users/hadley/repos","events_url":"https://api.github.com/users/hadley/events{/privacy}","received_events_url":"https://api.github.com/users/hadley/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":2,"state":"open","created_at":"2015-12-15T15:34:58Z","updated_at":"2016-01-25T16:47:27Z","due_on":null,"closed_at":null},"comments":0,"created_at":"2016-01-13T19:12:29Z","updated_at":"2016-01-25T16:47:27Z","closed_at":"2016-01-25T16:47:27Z","body":"When looking at [this SO question](http://stackoverflow.com/questions/34774120/set-number-of-bins-for-histogram-directly-in-ggplot), 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:\r\n\r\n    ggplot(data = iris, aes(x = Sepal.Length)) + stat_bin(bins = 3)\r\n\r\nproduces\r\n![histogram with four bins](https://cloud.githubusercontent.com/assets/1693477/12304650/a0729ee0-b9fe-11e5-81c7-064d3fe65470.png)\r\n\r\nwhich certainly doesn't seem like what most people would expect. Is this a zero-based index issue?\r\n\r\nApologies if I'm missing something obvious, and thanks for all your work."}}