Mastering Seaborn

An interactive infographic for the 80/20 of Visualization in Python.

🌈 Seaborn Master Reference Table

Your quick guide to high-level statistical plotting. Click any function to visit the official Seaborn documentation.

📚 Key Documentation Links

Seaborn API Reference → The complete API reference for all Seaborn functions.

Seaborn Tutorials & Examples → In-depth guides and examples for creating beautiful plots.

Key Concepts (The Seaborn Way)

Seaborn's philosophy for high-level plotting.

Tidy DataData-AwareFigure-levelAxes-levelSemantic MappingMatplotlib Backend

Core Functions (The Starting Points)

The building blocks for any Seaborn visualization.

sns.set_theme()sns.load_dataset()sns.relplot()sns.displot()sns.catplot()sns.lmplot()

Recommended Learning Path

A structured approach to creating statistical graphics with Seaborn.

1

Load Data & Set Style

sns.load_dataset('tips'), sns.set_theme()

2

Choose a Plot

sns.scatterplot(data=..., x=..., y=...)

3

Add Semantics

hue='smoker', style='time', size='size'

4

Customize & Show

plt.title('My Plot'), plt.show()

Core Plot Categories

Seaborn groups its functions into logical categories for easy discovery.

Relational Plots

Understand relationships between variables. (`scatterplot`, `lineplot`)

Distribution Plots

Visualize the distribution of a dataset. (`histplot`, `kdeplot`, `ecdfplot`)

Categorical Plots

Explore relationships with categorical data. (`barplot`, `boxplot`, `violinplot`)

Matrix Plots

Visualize matrix data as color-encoded grids. (`heatmap`, `clustermap`)

Full A-Z Quick Reference

A searchable list of the most common Seaborn functions.

Function Description

Complete Function Inventory

A visual guide to the most common functions in seaborn.

Plotting Functions

barplot()

Bar plots with confidence intervals.

sns.barplot(data=df, x="day", y="total_bill")

boxplot()

Box and whisker plots.

sns.boxplot(data=df, x="day", y="total_bill")

catplot()

Figure-level interface for categorical plots.

sns.catplot(data=df, x="day", y="total_bill", kind="box", col="time")

countplot()

Show counts of categories.

sns.countplot(data=df, x="day")

displot()

Figure-level interface for distribution plots.

sns.displot(data=df, x="total_bill", col="time", kind="kde")

distplot() (deprecated)

Histogram with KDE.

sns.distplot(df["total_bill"])

ecdfplot()

Empirical Cumulative Distribution Function.

sns.ecdfplot(data=df, x="total_bill")

histplot()

Histogram with optional KDE.

sns.histplot(data=df, x="total_bill", kde=True)

jointplot()

Scatter plot with marginal distributions.

sns.jointplot(data=df, x="total_bill", y="tip")

kdeplot()

Kernel Density Estimate plot.

sns.kdeplot(data=df, x="total_bill")

lmplot()

Figure-level regression plots.

sns.lmplot(data=df, x="total_bill", y="tip", col="time")

pairplot()

Scatter plot matrix.

sns.pairplot(df)

pointplot()

Point estimates with confidence intervals.

sns.pointplot(data=df, x="day", y="tip")

regplot()

Linear regression plot.

sns.regplot(data=df, x="total_bill", y="tip")

relplot()

Figure-level relational plots.

sns.relplot(data=df, x="total_bill", y="tip", hue="smoker", col="time")

residplot()

Residual plot for regression.

sns.residplot(data=df, x="total_bill", y="tip")

rugplot()

Marginal tick plots.

sns.rugplot(data=df, x="total_bill")

scatterplot()

Scatter plot with grouping.

sns.scatterplot(data=df, x="total_bill", y="tip", hue="smoker")

stripplot()

Scatter plot for categorical data.

sns.stripplot(data=df, x="day", y="total_bill")

swarmplot()

Non-overlapping categorical scatter plot.

sns.swarmplot(data=df, x="day", y="total_bill")

violinplot()

Violin plots.

sns.violinplot(data=df, x="day", y="total_bill")

Figure-Level Functions

FacetGrid()

Multi-plot grid for conditional relationships.

g = sns.FacetGrid(df, col="time", row="sex")
g.map(sns.scatterplot, "total_bill", "tip")

PairGrid()

Grid for pairwise relationships.

g = sns.PairGrid(df)
g.map(sns.scatterplot)

JointGrid()

Grid for joint and marginal distributions.

g = sns.JointGrid(data=df, x="total_bill", y="tip")
g.plot(sns.scatterplot, sns.histplot)

Styling Functions

Control the look and feel of your plots with these aesthetic functions.

set()

Set aesthetic parameters in one step.

sns.set(style="whitegrid", palette="muted")

set_style()

Set the aesthetic style of the plots.

sns.set_style("darkgrid")
Aa Aa Aa

set_context()

Set plotting context parameters.

sns.set_context("talk")

set_palette()

Set the color palette for all plots.

sns.set_palette("viridis")

axes_style()

Return parameters of a style, or temporarily set style.

with sns.axes_style("whitegrid"):
    sns.boxplot(...)
Aa

plotting_context()

Return parameters of a context, or temporarily set context.

with sns.plotting_context("paper"):
    sns.lineplot(...)

color_palette()

Return a list of colors defining a palette.

sns.color_palette("pastel")

diverging_palette()

Make a diverging palette between two HUSL colors.

sns.diverging_palette(220, 20, as_cmap=True)

light_palette() / dark_palette()

Make a sequential palette from a single color.

sns.light_palette("green", as_cmap=True)

cubehelix_palette()

Make a sequential palette from the cubehelix system.

sns.cubehelix_palette(as_cmap=True)

husl_palette() / hls_palette()

Make a palette with evenly spaced hues in HUSL or HLS.

sns.husl_palette(n_colors=8)

blend_palette()

Make a palette by blending a list of colors.

sns.blend_palette(["blue", "pink"], n_colors=10)

xkcd_palette()

Make a palette with colors from the xkcd color survey.

sns.xkcd_palette(["windows blue", "amber"])

Critical Functions (The 20% You'll Use 80% of the Time)

The minimal set needed for the vast majority of data visualization tasks.

scatterplot()

Fundamental visualization for relationships.

sns.scatterplot(data=df, x="bill", y="tip")

lineplot()

Essential for time series and trend visualization.

sns.lineplot(data=df, x="date", y="price")

barplot()

Most common categorical comparison.

sns.barplot(data=df, x="day", y="total_bill")

histplot()

Primary distribution visualization.

sns.histplot(data=df, x="age")

boxplot()

Standard statistical representation.

sns.boxplot(data=df, x="class", y="score")

heatmap()

Critical for correlation and matrix data.

sns.heatmap(df.corr(), annot=True)

pairplot()

Key EDA tool for multivariate data.

sns.pairplot(df, hue="species")

lmplot() / regplot()

Core regression visualization.

sns.regplot(data=df, x="bill", y="tip")

FacetGrid()

Enables complex multi-plot layouts.

g = sns.FacetGrid(df, col="time")
g.map(sns.histplot, "tip")

set_style() / set_palette()

Critical for visual polish and aesthetics.

sns.set_style("whitegrid")
sns.set_palette("flare")

Important Functions (The Supporting Cast)

Enhance critical plots and provide essential supporting functionality.

violinplot()

Enhanced distribution view combining a boxplot with a KDE.

sns.violinplot(data=df, x="day", y="tip")

stripplot() / swarmplot()

Categorical scatter variants for individual data points.

sns.swarmplot(data=df, x="day", y="total_bill")

kdeplot()

Smooth density visualization using Kernel Density Estimation.

sns.kdeplot(data=df, x="total_bill", hue="time")

jointplot()

Visualize bivariate distributions with marginal plots.

sns.jointplot(data=df, x="bill", y="tip", kind="hex")

countplot()

Show the counts of observations in each category.

sns.countplot(data=df, x="day", hue="sex")

relplot() / catplot()

Figure-level interfaces for relational and categorical plots.

sns.catplot(data=df, x="day", y="tip", kind="swarm")

displot()

Modern figure-level interface for distribution plots.

sns.displot(data=df, x="bill", kind="ecdf")

color_palette()

Define or return a color palette for customization.

my_palette = sns.color_palette("pastel")
sns.barplot(..., palette=my_palette)

load_dataset()

Convenient access to example datasets.

tips_df = sns.load_dataset("tips")

despine()

Aesthetic refinement by removing top and right spines.

sns.lineplot(...)
sns.despine(left=True)

Utility Functions (The Tool-belt)

Convenience functions for data, aesthetics, and plot management.

load_dataset()

Load an example dataset from the online repository.

flights_df = sns.load_dataset("flights")

despine()

Remove the top and right axis spines from a plot.

sns.lineplot(...)
sns.despine()

mpl.pyplot.show()

Display all open figures (from Matplotlib).

import matplotlib.pyplot as plt
sns.histplot(...)
plt.show()

move_legend()

Re-position a plot's legend.

g = sns.lineplot(...)
sns.move_legend(g, "lower left")

clustermap()

Plot a hierarchically-clustered heatmap.

sns.clustermap(df, metric="correlation")
.9 .2

heatmap()

Create an annotated heatmap of matrix data.

sns.heatmap(df.corr(), annot=True, fmt=".2f")

lineplot() (aggregation)

Line plot with confidence interval aggregation.

sns.lineplot(data=df, x="time", y="value")

palplot()

Plot the values in a color palette as a horizontal array.

sns.palplot(sns.color_palette("husl", 8))

Advanced & Internal Utilities

These are less common, used for specific cases or internally by other Seaborn functions.

regression.regplot() utils.ci_to_errsize() utils.get_dataset_names() axisgrid.Grid() _DistributionPlotter _DendrogramPlotter

🌈 Seaborn Plotting Examples

Creating advanced statistical graphics from a Pandas DataFrame with simple commands.

Step 1: The Sample Dataset

Monthly Sales Data

Month Product A Product B Product C
Jan150200180
Feb180210190
Mar170220200
Apr160230210
May190240220

Create DataFrame

We start with the same Pandas DataFrame.

import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt

data = {
    "Month": ["Jan", "Feb", "Mar", "Apr", "May"],
    "Product A": [150, 180, 170, 160, 190],
    "Product B": [200, 210, 220, 230, 240],
    "Product C": [180, 190, 200, 210, 220]
}
df = pd.DataFrame(data)

Step 2: Convert to Long-Form Data (Tidy Data)

For many categorical plots, Seaborn works best with "long-form" or "tidy" data, where each row is a single observation. We use `df.melt()` for this transformation.

Using `df.melt()`

df_melted = df.melt(
    id_vars="Month", 
    var_name="Product", 
    value_name="Sales"
)

Resulting `df_melted`

"Wide" format (3 columns of values) is transformed into "Long" format (1 column for categories, 1 for values).

Wide DF Long DF

1. Relational Plots

Line Plot

sns.lineplot(data=df_melted, x="Month", y="Sales", hue="Product", marker="o")
plt.title("Monthly Sales Line Plot")
plt.show()

Line Plot Visualization

2. Categorical Plots

Bar Plot

sns.barplot(data=df_melted, x="Month", y="Sales", hue="Product")
plt.title("Monthly Sales Bar Plot")
plt.show()

Bar Plot Visualization

Box Plot

sns.boxplot(data=df_melted, x="Product", y="Sales")
plt.title("Sales Distribution per Product")
plt.show()

Box Plot Visualization

3. Distribution Plots

Histogram + KDE

sns.histplot(df["Product A"], bins=5, kde=True)
plt.title("Product A Sales Distribution")
plt.show()

Histogram Visualization

4. Matrix / Heatmap Plots

Correlation Heatmap

corr = df.drop("Month", axis=1).corr()
sns.heatmap(corr, annot=True, cmap="coolwarm")
plt.title("Product Correlation")
plt.show()

Heatmap Visualization

1.0
0.4
0.2
0.4
1.0
0.9
0.2
0.9
1.0

5. Regression & Statistical Plots

Regression Plot

sns.regplot(x=df.index, y=df["Product A"])
plt.title("Product A Trend")
plt.show()

Regression Plot Visualization

6. Themes & Styles

Styling a Plot

sns.set_style("whitegrid")
sns.set_context("talk")
sns.set_palette("Set2")

sns.lineplot(data=df, x="Month", y="Product A")
plt.title("Styled Plot Example")
plt.show()

Styled Plot Visualization