Skip to content

04-05: Distribution Analyzer

Python: Data Analytics

View the live site — ijk37.com

Project 05

Home  |  All Projects  |  Notes  |  Exercises  |  Quiz Hub

Generates 2000 random samples from four distributions (Normal, Uniform, Exponential, Binomial) and plots each as a histogram with mean line, ±1σ lines, shaded IQR, and a stats text box. A second figure overlays all four normalised distributions for comparison.

Topics covered: np.random.normal/uniform/exponential/binomial · ax.hist(density=True) · ax.axvline() · ax.axvspan() · np.percentile() · ax.text() with bbox · fig.add_subplot()

Difficulty: ⭐⭐ Intermediate


Requirements

pip install matplotlib numpy

How to Run

python main.py

Outputs: distributions.png, distributions_overlay.png


Key Concepts Practised

Concept Where used
np.random.normal(loc=70, scale=15) Normal distribution
ax.hist(bins=30, density=False) Frequency histogram
ax.hist(density=True) Normalised (comparable) histogram
ax.axvline(mean) Mean marker line
ax.axvspan(q25, q75) Shaded IQR region
ax.text(transform=ax.transAxes) Stats box in axes coordinates