I'd like to feed geom_histogram
the number of bins for my histogram instead of controlling bins through binwidth
. The documentation says I can do this by setting the bins
argument. But when I run
ggplot(data = iris, aes(x = Sepal.Length)) + stat_bin(bins = 5)
I get an output message with 30 bins, as if I didn't specify binwidth at all.
stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust this.
I've tried feeding this argument to stat_bin
and qplot
with the same problem. Am I doing something wrong?
I'm using ggplot2 version 1.0.1.