aNet.ai
Data Science/Learning path
0day streak0XP · Lv 1
← 6. Data Visualisation
Lesson 8.6 7 min · 252 words

Histograms: bins and bin width

A histogram counts numerical values in touching intervals. Different bin widths show the same data differently, so a real pattern should survive sensible choices.

A histogram groups numerical observations into adjacent intervals called bins. Bars touch because the intervals are continuous; each value enters exactly one bin (W6 p. 10). Interval notation makes the boundary rule explicit: [40,60) includes 40 and excludes 60. The final bin normally includes its right end, so [80,100] includes a grade of 100. Category bars, unlike histogram bins, keep gaps because categories are separate.

W6 p. 12 groups the same 20 grades two ways:

Bins Counts Total
Finer: 0-20, 20-40, 40-60, 60-80, 80-100 1, 3, 7, 6, 3 20
Coarser: 0-40, 40-80, 80-120 4, 13, 3 20

Both totals are 20, but the coarse version merges the 7 and 6 into one bar of 13 and hides whether grades peak below or above 60. Very narrow bins show noise; very wide bins hide shape. A pattern worth reporting should survive reasonable bin choices. (The slide's last coarse bin is labelled 80-120 only to keep equal widths; grades end at 100, so in your own charts keep labels within the measured range.)

Lab 6 Task 2 uses grades 42, 47, 53, 58, 61, 64, 65, 78. Edges [40, 50, 60, 70, 80] give counts 2, 2, 3, 1 (sum 8); edges [40, 60, 80] give 4, 4. Changing bins changes the picture, not the grades. In NumPy and matplotlib every bin is left-closed and right-open except the last, which includes its right edge.

Source: W6 PDF pp. 1-37. Most numbers in the lecture are illustrative or constructed for teaching; pp. 26-27 reuse the Week 5 synthetic registration counts. The Week 6 lab manual (L6) practises Week 5 EDA reasoning and is worked through section by section in Lab work.

Practice problems

Supplementary study questions on the lecture concepts — not verbatim exam questions. Each answer counts toward spaced review.

1. Conceptual understanding

Definitions and distinctions.

Question 1 of 6 · +5 XP

In interval notation, what does [40,60) include?

Question 2 of 6 · +5 XP

Why do histogram bars touch?

2. Application

Apply the concept to a case or calculation.

Question 3 of 6 · Counting · +5 XP

Grades 42, 47, 53, 58, 61, 64, 65, 78 with edges 40, 50, 60, 70, 80. How many are in [60,70)?

Question 4 of 6 · Final bin · +5 XP

With edges 40, 60, 80, where does a grade of 80 go?

3. Interpretation and limitations

Evaluate assumptions and justify conclusions.

Question 5 of 6 · Bin width · +5 XP

What is the risk of very wide bins?

Question 6 of 6 · Robustness · +5 XP

What should you check before reporting a histogram pattern?

Explain it in writing

Self-checked, not marked. Write a few sentences, then compare with the example answer. Your writing is saved as you type.

Show an example answer

Histogram bins are adjacent intervals on one continuous number line, so they meet. Bar-chart categories are separate groups with no values between them.

Check: did you answer the question, use evidence or working, and avoid claiming more than the evidence supports?

Show an example answer

The 7 and 6 merge into 13, so you can no longer see that the peak lies in 40–60 rather than 60–80. Both versions still total 20.

Check: did you answer the question, use evidence or working, and avoid claiming more than the evidence supports?

Practice this topic
Saved in this browser as you type.
aNet.ai · Data Science Fundamentals · Weeks 1–6 · practice material, not an official examProgress saved in this browser