# Histogram with variable bin size [closed]

Suppose I have some dataset,e.g.,

Histogram[RandomVariate[PoissonDistribution[2], 10000], 10]


which gives,

$\hspace{2cm}$

How can I change the histogram such that it has variable bin size such, e.g., the first six bins have size 1 while the last two have size 2?

## closed as off-topic by m_goldberg, ybeltukov, Teake Nutma, Karsten 7., Sjoerd C. de VriesSep 12 '14 at 20:35

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – m_goldberg, ybeltukov, Teake Nutma, Karsten 7., Sjoerd C. de Vries
If this question can be reworded to fit the rules in the help center, please edit the question.

From the documentation of Histogram:

Histogram[{Subscript[x, 1],Subscript[x, 2],[Ellipsis]},bspec,hspec]

bspec: {{b1,b2,b3...}} use the bins [b1,b2),[b2,b3),...

Therefore,

Histogram[
RandomVariate[PoissonDistribution[3],
10000], {{1, 2, 3, 4, 6, 8, 10, 12}}]


• Just what I was looking for. I'm not sure how I missed this. Thanks! – JeffDror Sep 12 '14 at 13:53
• I guess the lesson is to always read the "Details and Options" part of the documentation. – rhermans Sep 12 '14 at 13:57

The function BinCountsallows you to specify variable bin sizes.

BarChart[
BinCounts[RandomVariate[PoissonDistribution[2],10000], {{0, 1, 2, 3, 4, 5, 6, 8, 10}}],
BarSpacing -> None, Frame -> True]