So I wanted to create a Histogram with a custom number of bins. Luckily there is a simple function for this in the form of Histogram[data, n] where n specifies the number of bins. There is even an example of using it in the documentation:
data = RandomVariate[NormalDistribution[0, 1], 200];
Histogram[data, 5]
Problem is that this doesn't produce a Histogram with five bins but with seven bins:

Histogram[data, 6]still gives seven bins:

Histogram[data, 7] also gives seven bins:

But Histogram[data, 10] gives thirteen bins:

Now I am utterly confused. Is this a bug or have I misunderstood something completely? How would I go about producing a Histogram with five bins?




FindDivisions. – Heike Jun 30 '12 at 18:08