A histogram bins continuous numerical data into discrete intervals and counts how many observations fall into each bin, revealing central tendency, skewness, spread, and multi-modal distributions.
Sorting coins through a coin separator into specific slot buckets based on diameter.
`bins=10` creates 10 equal-width buckets. You can also pass explicit bin edges `bins=[0, 50, 75, 100, 150]`.
plt.hist(data, bins=20)Setting `density=True` normalizes bin heights so the total area under the histogram integrates to 1.0.
plt.hist(data, bins=15, density=True)Avoid the top errors and bad plotting practices that trip up new Python developers
Switch from abstract numbers to relatable Cricket, Cinema & Business charts
Write Matplotlib code to solve the objective and see your live plot render
Plot a histogram of `data = [12, 15, 18, 22, 25, 29, 31, 35, 40, 42, 48, 50]` with `bins=6` and `color='#FFB86B'`.
✓ plt.hist✓ binsTest your understanding to unlock the lesson completion badge