# Idea

4 Likes"
suggested commented

## Histograms: Automatic Number of Bins / Bin Width Selection

This was originally Marco's idea. The idea is that there should be an "auto" setting, for how the histogram determines the number of bars to show. As the amount of data increases, so could the number of bars, so that more data leads to a higher "resolution" histogram.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

·
1 Like"
commented

The number of bars could be the absolute value of 1 + 3.332 * log (base 10) N where N is the sample size. But some other rule can be used.

In any case I think this should be an option that can be disabled.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Like"
commented

Another method to calculate the optimal bin width / bin count of the histogram is Shimazaki and Shinamoto's method:

Histogram Bin-width Optimization

The page has code samples for Matlab, R, Python, Excel, and explains the method in detail.

This approach may appear more complex than various rules-of-thumb formulas, but it's easy to implement, and it produces great results even with multimodal distributions. Unlike Freedman-Diaconis rule, which in my experience is hit or miss, this method is insensitive to the scaling of data.

In a simulation I'm working on right now, there is a parameter with a peculiar multimodal distribution. This is how it looks like on histograms plotted according to different rules for the bin count. Please note how Shimazaki and Shinamoto's method reduces the bin width just enough to see the multimodal structure of the data distribution:

It would be nice if FlexSim histograms supported this method.

· 1

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Thanks for implementing this in 2019.0!

0 Likes 0 ·

### Write a Comment

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.