Excel Histogram How does it calculate bin width

In summary, the conversation is about creating a histogram making code as an alternative to Excel. The person is looking for help with determining the bin width using a formula and wants it to result in sensible intervals. They are open to brainstorming and testing the data set to determine the appropriate decimal place for the bin width. They hope someone will join them in this project.
  • #1
Saladsamurai
3,020
7
Hey people,


I am trying to write my own histogram making code since the Excel one sucks IMO. I am having some trouble thinking the whole bin 'width' thing through though.
I plan on using the formula

number of bins = k = 1.87(N - 1)0.40 + 1​

Then I was going to figure out the bin width as

[tex]\frac{[MAX(data ) - MIN(data )]}{k}[/tex]​

This will get me in the ball park, but it will result in bin widths that are sloppy like 1.111 - 2.222 and the like. They should be sensible intervals like: 0 - 10, 10 - 20... etc or 0.10 - 0.12, 0.12 - 0.14...etc
Anyone care to brainstorm on me with this? I was thinking I could do some sort of test on the data set to determine what decimal place the bin width needs to go out to.

Hopefully someone can decipher what I am talking about here and wants to jump on board! :smile:
 
Last edited:
Physics news on Phys.org
  • #2
Any thoughts :smile:
 

Similar threads

Back
Top