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:
 

1. How do I create a histogram in Excel?

To create a histogram in Excel, go to the Insert tab and click on the column chart icon. Then, right-click on the chart and choose "Change Chart Type." In the options, select "Histogram" and click "OK."

2. How does Excel calculate bin width for a histogram?

Excel uses the Freedman-Diaconis rule to calculate the bin width for a histogram. This formula takes into account the sample size and the range of the data to determine an optimal bin width.

3. Can I customize the bin width in an Excel histogram?

Yes, you can customize the bin width in an Excel histogram. After creating the histogram, right-click on the horizontal axis and choose "Format Axis." In the options, you can adjust the bin width by changing the "Bin width" value.

4. Why is it important to choose an appropriate bin width for a histogram?

Choosing an appropriate bin width is important because it can greatly affect the visual appearance of the histogram and the interpretation of the data. Too few bins can result in oversimplification of the data, while too many bins can obscure important patterns.

5. Can I change the bin width after creating a histogram in Excel?

Yes, you can change the bin width after creating a histogram in Excel. Simply right-click on the horizontal axis and choose "Format Axis." Then, adjust the bin width by changing the "Bin width" value. Note that this will change the appearance of the histogram.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
6K
Replies
5
Views
850
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
3K
  • Calculus and Beyond Homework Help
Replies
4
Views
14K
  • Set Theory, Logic, Probability, Statistics
Replies
3
Views
7K
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
3K
Replies
11
Views
2K
  • Calculus and Beyond Homework Help
Replies
4
Views
5K
  • Advanced Physics Homework Help
Replies
3
Views
2K
Back
Top