Plotting missing values is one of the fastest ways to move from “there are missings” to “where, how many, and in what pattern?” Numbers alone (counts, percentages) hide clustering, correlations, and group-specific gaps. Visuals reveal the story — whether missingness is random, systematic, or tied to specific variables/groups — guiding your imputation or drop strategy.
In 2026, the gold standard remains missingno for quick, beautiful diagnostics, combined with seaborn heatmaps for deeper pattern analysis. Here’s a complete, practical guide with real examples and best practices.
1. Install & Quick Setup
# Install once (if needed)
# !pip install missingno
import pandas as pd
import missingno as msno
import seaborn as sns
import matplotlib.pyplot as plt
# Load realistic dataset with common missing patterns (Titanic-like)
df = pd.read_csv("https://raw.githubusercontent.com/datasciencedojo/datasets/master/titanic.csv")
2. The Classic: Missingno Matrix Plot
Shows missingness as a vertical barcode — white = missing. Great for spotting patterns across rows/columns.
plt.figure(figsize=(12, 8))
msno.matrix(df, figsize=(12, 8), color=(0.25, 0.5, 0.9), fontsize=12)
plt.title('Missing Values Matrix (White = Missing)', fontsize=14, pad=20)
plt.tight_layout()
plt.show()
**What to look for:**
- Vertical white bands ? columns with high missingness
- Horizontal white streaks ? rows with many missings (e.g., specific groups)
- Sparkline on right ? shows total non-missing per row
3. Missingno Bar Plot (Quick Severity View)
plt.figure(figsize=(10, 6))
msno.bar(df, color='teal', fontsize=12)
plt.title('Missing Values Count per Column', fontsize=14, pad=15)
plt.tight_layout()
plt.show()
4. Seaborn Heatmap (Correlation of Missingness)
Reveals if missingness in one column predicts missingness in another (MAR pattern).
plt.figure(figsize=(10, 8))
sns.heatmap(df.isna().corr(), annot=True, cmap='coolwarm', vmin=-1, vmax=1, fmt='.2f')
plt.title('Correlation of Missingness Across Columns', fontsize=14)
plt.tight_layout()
plt.show()
**Interpretation:**
- High positive correlation ? missingness is related (e.g., Age missing when Cabin missing)
- Near zero ? missingness is likely independent (MCAR)
5. Bonus: Polars + Basic Visualization (2026 Speed Option)
import polars as pl
df_pl = pl.from_pandas(df)
# Count nulls per column
null_counts = df_pl.null_count().transpose(include_header=True, header_name="column", column_names=["count"])
print("Null count per column (Polars):")
print(null_counts.filter(pl.col("count") > 0))
# For visual — convert to pandas (Polars doesn't have built-in missingno equivalent yet)
msno.matrix(df_pl.to_pandas(), figsize=(12, 6))
plt.title('Missing Values Matrix (Polars ? Pandas)', fontsize=14)
plt.show()
Best Practices & What to Look For (2026 Edition)
- Start with
msno.matrix()— it’s the single most informative missingness visual - Look for **clustering** — missingness in blocks (e.g., by date, group, or region) suggests systematic issues
- Check **missingness correlation** — high values indicate MAR (missing at random conditional on other variables)
- Combine with groupby — e.g.,
df.groupby('Survived')['Age'].apply(lambda x: x.isna().mean()*100) - Pitfall: ignoring pattern ? mean imputation on clustered missings can introduce severe bias
- Large data? Use Polars for counting, then sample to pandas for visuals — missingno doesn’t scale to 10M+ rows
- Production tip: log missing % and patterns — alert if > threshold or if new patterns appear
Conclusion
Plotting missing values with missingno (matrix + bar) and seaborn heatmaps turns a dry count into a diagnostic story — revealing not just how much is missing, but where, how clustered, and whether it’s random or informative. In 2026, run these visuals immediately after loading any dataset. They guide every decision: drop, fill simply, impute smartly (KNN/MICE), or investigate the data collection process. Master visual missingness detection, and you’ll build more robust, less biased models and analyses.
Next time you see NaNs — don’t just count them. Plot them first. The picture will tell you what the numbers never can.