seaborn
Statistical data visualization built on matplotlib — beautiful charts with sensible defaults and one-line syntax.
matplotlib gives you full power but requires a lot of code for common statistical plots like distributions, correlations, and categorical comparisons. Styling it to look good takes even more effort.
seaborn is a high-level wrapper around matplotlib. Think of it as matplotlib with pre-built chart types for statistics, better color palettes by default, and tight pandas integration. It still returns matplotlib Figure/Axes objects, so you can drop down to matplotlib for fine-tuning.
Correlation matrix heatmap
import seaborn as sns
import pandas as pd
df = sns.load_dataset('iris') # or your own DataFrame
corr = df.select_dtypes('number').corr()
sns.set_theme(style='white')
fig = sns.heatmap(
corr,
annot=True, # show numbers
fmt='.2f',
cmap='coolwarm',
center=0,
square=True,
linewidths=0.5
).figure
fig.suptitle('Feature Correlations')
fig.tight_layout()Use it when
Exploratory data analysis, correlation matrices, distribution comparisons, categorical plots, regression plots, or any time you want a beautiful statistical chart in a few lines.
Skip it when
Custom non-statistical visualizations, interactive web charts, or when you need pixel-perfect control over layout.
Ready to explore the full API?
See every class, function, and relationship in an interactive graph.