# Seaborn Cheat Sheet: Plot Functions and Common Commands

> Seaborn cheat sheet with a downloadable one-page PNG: code for histplot, kdeplot, scatterplot, boxplot, heatmap and more, plus displot, catplot, themes, palettes, move_legend and savefig.

Source: https://www.pythoncharts.com/seaborn/seaborn-cheat-sheet/ | Published: 2026-12-06 | Author: Alex Scott | Category: Seaborn | Tags: seaborn, cheat-sheet, plot types, themes, facetgrid, python

Most Seaborn charts are one call: pass a DataFrame as `data=` and name its columns, as in `sns.scatterplot(data=df, x="temp", y="sales", hue="cafe")`. Functions like `histplot` and `boxplot` draw on a Matplotlib Axes, while `displot`, `catplot`, and `relplot` build a whole figure of facets. This cheat sheet collects both kinds on one page, with copyable tables below.

## Quick Example

A scatter plot with a color per group, a theme, labels, and the legend moved outside. The code needs only the imports and the data it creates.

```python
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns

rng = np.random.default_rng(21)
cafe = rng.choice(["North", "South", "East"], 240)
df = pd.DataFrame({"cafe": cafe, "temp": rng.normal(18, 6, 240)})
df["sales"] = 40 + 3 * df["temp"] + 25 * (cafe == "North") + rng.normal(0, 12, 240)

sns.set_theme(style="whitegrid")
fig, ax = plt.subplots(figsize=(8, 4.5), layout="constrained")
sns.scatterplot(data=df, x="temp", y="sales", hue="cafe", ax=ax)
ax.set(title="Daily sales vs temperature", xlabel="Temperature (C)", ylabel="Sales")
sns.move_legend(ax, "upper left", bbox_to_anchor=(1, 1))
plt.show()
```

![Seaborn scatter plot of sales against temperature with points colored by cafe, a whitegrid theme and the legend outside the plot](https://www.pythoncharts.com/seaborn/seaborn-cheat-sheet/images/seaborn-cheat-sheet-quick-example.png)

Sales rise with temperature (a correlation of 0.73 in this data), and the North cafe averages 117 against 93 for East and 98 for South, so its points sit higher.

## Download the Seaborn Cheat Sheet

[Download the full-size cheat sheet (PNG)](https://www.pythoncharts.com/seaborn/seaborn-cheat-sheet/images/seaborn-cheat-sheet.png). Every chart on it is drawn by the code printed beside it, with Seaborn 0.13.

![One page Seaborn cheat sheet with setup code, twelve plot functions each shown with its code, and reference panels for figure-level functions, themes and colors, labels and legends, and layout and saving](https://www.pythoncharts.com/seaborn/seaborn-cheat-sheet/images/seaborn-cheat-sheet.png)

## Setup Code for the Examples

The snippets in the tables below use these variables. The data is made up (seeded, so you get the same numbers): 240 days at three cafes.

```python
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns

rng = np.random.default_rng(8)
cafe = rng.choice(["North", "South", "East"], 240)
df = pd.DataFrame({"cafe": cafe,
                   "temp": rng.normal(18, 6, 240),
                   "week": rng.integers(1, 13, 240)})
df["sales"] = (40 + 3 * df["temp"]
               + 25 * (cafe == "North")
               + rng.normal(0, 12, 240))
df["visits"] = df["sales"] / 4 + rng.normal(0, 5, 240)
sns.set_theme()
fig, ax = plt.subplots()
```

## Seaborn Plot Types

These are axes-level functions: each draws on `ax` (or the current Axes) and returns it. Add `ax=` to choose where.

| Chart (links to guide) | Code |
|---|---|
| [Histogram](https://www.pythoncharts.com/seaborn/seaborn-histplot-displot/) | `sns.histplot(data=df, x="sales", bins=20)` |
| [Density](https://www.pythoncharts.com/seaborn/seaborn-kdeplot-density/) | `sns.kdeplot(data=df, x="sales", hue="cafe")` |
| [Scatter](https://www.pythoncharts.com/seaborn/seaborn-scatterplot/) | `sns.scatterplot(data=df, x="temp", y="sales", hue="cafe")` |
| [Line with confidence band](https://www.pythoncharts.com/seaborn/seaborn-lineplot/) | `sns.lineplot(data=df, x="week", y="sales")` |
| [Bar (mean)](https://www.pythoncharts.com/seaborn/seaborn-barplot/) | `sns.barplot(data=df, x="cafe", y="sales")` |
| [Count](https://www.pythoncharts.com/seaborn/seaborn-countplot/) | `sns.countplot(data=df, x="cafe")` |
| [Box](https://www.pythoncharts.com/seaborn/seaborn-boxplot/) | `sns.boxplot(data=df, x="cafe", y="sales")` |
| [Violin](https://www.pythoncharts.com/seaborn/violin-plots-seaborn/) | `sns.violinplot(data=df, x="cafe", y="sales")` |
| [Strip (jittered points)](https://www.pythoncharts.com/seaborn/seaborn-beeswarm-plot/) | `sns.stripplot(data=df, x="cafe", y="sales")` |
| [Regression](https://www.pythoncharts.com/seaborn/seaborn-regplot-lmplot/) | `sns.regplot(data=df, x="temp", y="sales")` |
| [Heatmap](https://www.pythoncharts.com/seaborn/heatmaps-seaborn/) | `sns.heatmap(df.corr(numeric_only=True), annot=True, fmt=".2f")` |
| ECDF | `sns.ecdfplot(data=df, x="sales", hue="cafe")` |

`barplot` shows the mean with a bootstrapped 95% confidence interval by default, and `lineplot` does the same for each x value. Use `errorbar="sd"` for the standard deviation instead.

## Figure-Level Functions: displot, catplot, relplot

Figure-level functions create their own figure, split it by `col=` or `row=`, and return a `FacetGrid` (or `PairGrid` / `JointGrid`). They don't take `ax=`.

| Task | Code |
|---|---|
| Distribution per group | `g = sns.displot(data=df, x="sales", col="cafe")` |
| Category plot per group | `g = sns.catplot(data=df, x="cafe", y="sales", kind="box")` |
| Relationship per group | `g = sns.relplot(data=df, x="temp", y="sales", col="cafe")` |
| Regression per group | `g = sns.lmplot(data=df, x="temp", y="sales", hue="cafe")` |
| Every pair of columns | `g = sns.pairplot(df, hue="cafe")` |
| Scatter plus marginals | `g = sns.jointplot(data=df, x="temp", y="sales")` |

`catplot` takes `kind="strip"`, `"swarm"`, `"box"`, `"violin"`, `"boxen"`, `"point"`, `"bar"`, or `"count"`. Which family a function belongs to is covered in [figure-level vs axes-level](https://www.pythoncharts.com/seaborn/seaborn-figure-level-vs-axes-level/), and the extras in [pairplot](https://www.pythoncharts.com/seaborn/seaborn-pairplot/) and [jointplot](https://www.pythoncharts.com/seaborn/seaborn-jointplot-bivariate-distributions/).

## Themes and Colors

| Task | Code |
|---|---|
| Theme | `sns.set_theme(style="whitegrid")` |
| Size preset | `sns.set_context("talk")` |
| Default palette | `sns.set_palette("Set2")` |
| Palette for one plot | `sns.scatterplot(data=df, x="temp", y="sales", hue="cafe", palette="Set2")` |
| List of colors | `colors = sns.color_palette("viridis", 4)` |
| Remove top and right spines | `sns.despine()` |

`style` takes `"darkgrid"` (the default), `"whitegrid"`, `"dark"`, `"white"`, or `"ticks"`. `set_context` takes `"paper"`, `"notebook"` (the default), `"talk"`, or `"poster"`, and scales fonts and line widths. See [themes](https://www.pythoncharts.com/seaborn/seaborn-themes-set-theme/) and [custom color palettes](https://www.pythoncharts.com/seaborn/seaborn-custom-color-palettes/).

## Labels, Category Order, and Legends

| Task | Code |
|---|---|
| Axis labels | `ax.set(xlabel="Temp (C)", ylabel="Sales")` |
| Title | `ax.set_title("Title")` |
| Rotate tick labels | `ax.tick_params(axis="x", rotation=45)` |
| Category order | `sns.boxplot(data=df, x="cafe", y="sales", order=["South", "North", "East"])` |
| Move the legend | `sns.move_legend(ax, "upper left", bbox_to_anchor=(1, 1))` |
| Facet titles | `g.set_titles("{col_name}")` |

On a figure-level plot, call these on the returned grid: `g.set_axis_labels("Sales", "Count")`, `g.set_titles(...)`, `g.figure.suptitle(...)`. More in [category order](https://www.pythoncharts.com/seaborn/seaborn-order-x-axis-categories/), [move_legend](https://www.pythoncharts.com/seaborn/seaborn-move-legend/), and [FacetGrid titles](https://www.pythoncharts.com/seaborn/seaborn-facetgrid-titles/).

## Layout, Size, and Saving

| Task | Code |
|---|---|
| Several plots in one figure | `fig, axs = plt.subplots(1, 2)`<br>`sns.histplot(data=df, x="sales", ax=axs[0])` |
| Size (axes-level) | `fig, ax = plt.subplots(figsize=(8, 5))` |
| Size (figure-level) | `sns.displot(data=df, x="sales", height=3, aspect=1.5)` |
| Standard deviation bars | `sns.lineplot(data=df, x="week", y="sales", errorbar="sd")` |
| Save (axes-level) | `plt.savefig("plot.png", dpi=200, bbox_inches="tight")` |
| Save (figure-level) | `g.savefig("plot.png", dpi=200)` |

For axes-level functions you set the size on the Matplotlib figure. For figure-level ones, `height` is per facet and `aspect` is width divided by height, so a `col=` grid of three is about three times as wide as `height * aspect`. See [subplots](https://www.pythoncharts.com/seaborn/seaborn-subplots/) and [saving high-resolution figures](https://www.pythoncharts.com/seaborn/seaborn-save-high-resolution-figures/).

## Which Seaborn Function Should I Use?

| You have | Use |
|---|---|
| One numeric column | `histplot`, `kdeplot`, `ecdfplot` |
| A number per category | `boxplot`, `violinplot`, `stripplot`, `barplot` |
| Counts of categories | `countplot` |
| Two numeric columns | `scatterplot`, `regplot`, `lineplot` (if x is ordered) |
| A matrix or correlations | `heatmap`, `clustermap` |
| Any of the above split by a column | the figure-level version: `displot`, `catplot`, `relplot` |

## Practical Tips

- **Pass `data=` and column names,** not arrays. Seaborn then labels the axes for you.
- **`hue` needs a column,** and in 0.13 a `palette` given without `hue` is deprecated.
- **Axes-level functions accept `ax=`; figure-level ones don't.** If an `ax=` call fails with `TypeError`, you probably have a figure-level function.
- **`sns.set_theme()` changes Matplotlib's global defaults,** so call it once at the top of a script.
- **`df.corr()` needs `numeric_only=True`** when the DataFrame has text columns.

## Similar Topics

- [Seaborn Tutorial: A Guide to Statistical Charts in Python](https://www.pythoncharts.com/seaborn/seaborn-tutorial/)
- [Seaborn Figure-Level vs Axes-Level Functions](https://www.pythoncharts.com/seaborn/seaborn-figure-level-vs-axes-level/)
- [Matplotlib Cheat Sheet: Plot Types and Common Commands](https://www.pythoncharts.com/matplotlib/matplotlib-cheat-sheet/)
