Histogram Plot

Purpose

Visualize the frequency distribution of a single continuous variable to understand its shape, central tendency, and spread.

Histogram = discrete distribution view
KDE = smooth distribution view

Analysis Type

Univariate

Documentation

What to Look For

1. Distribution Shape
2. Normality Check
3. Outliers
4. Range and Spread
5. Linearity

Code Example

# Basic histogram
plt.hist(df['column'], bins=30, edgecolor='black', alpha=0.7)
plt.title("Distribution of Variable")
plt.xlabel("Value")
plt.ylabel("Frequency")
plt.show()

# Seaborn with KDE overlay
sns.histplot(df['column'], kde=True, bins=30)
plt.title("Distribution with KDE")
plt.show()
Pro Tip

Use kde=True in sns.histplot() to overlay a kernel density estimate curve, which smooths the distribution and makes patterns easier to see. If the KDE curve is bell-shaped and symmetric, your data is likely normally distributed.

ML_AI/_feature_engineering/images/hist_kde-1.png