Seaborn is Python’s most elegant data visualisation library. Built on Matplotlib, it produces beautiful statistical charts with minimal code. This complete tutorial covers every chart type you need for data science work.
Setup
pip install seaborn matplotlib pandas
import seaborn as sns
import matplotlib.pyplot as plt
sns.set_theme(style='whitegrid', palette='husl')
tips = sns.load_dataset('tips')
print(tips.head())Distribution Plots
sns.histplot(data=tips, x='total_bill', kde=True, color='steelblue')
plt.title('Bill Distribution'); plt.show()
sns.boxplot(data=tips, x='day', y='total_bill', palette='Set2')
plt.show()
sns.violinplot(data=tips, x='day', y='total_bill', hue='sex', split=True)
plt.show()Relationship Plots
sns.scatterplot(data=tips, x='total_bill', y='tip', hue='sex', size='size', sizes=(50,200))
plt.show()
sns.regplot(data=tips, x='total_bill', y='tip',
scatter_kws={'alpha':0.5}, line_kws={'color':'red'})
plt.show()Categorical Plots
sns.barplot(data=tips, x='day', y='tip', hue='sex', capsize=0.1)
plt.title('Average Tip by Day'); plt.show()
sns.countplot(data=tips, x='day', hue='smoker', palette='Set1')
plt.show()Heatmap (Correlation Matrix)
import numpy as np
corr = tips.select_dtypes(include=np.number).corr()
plt.figure(figsize=(7, 5))
sns.heatmap(corr, annot=True, fmt='.2f', cmap='coolwarm', center=0, square=True)
plt.title('Correlation Heatmap')
plt.tight_layout()
plt.show()Pair Plot
iris = sns.load_dataset('iris')
sns.pairplot(iris, hue='species', diag_kind='kde', plot_kws={'alpha':0.6})
plt.show()Saving Plots
plt.savefig('chart.png', dpi=300, bbox_inches='tight')
plt.savefig('chart.svg') # Vector for presentationsFAQ
Seaborn vs Matplotlib vs Plotly?
Seaborn for statistical analysis charts (fastest to beautiful). Matplotlib for full customisation. Plotly for interactive web dashboards. Most data scientists use all three.
How do I change Seaborn figure size?
plt.figure(figsize=(12, 6)) # before the seaborn call
sns.histplot(data=tips, x='total_bill')
plt.show()

