Written and maintained by CASRAI Editorial Board
Last updated
seaborn.pairplot() draws a grid of plots for every pair of numeric columns in a DataFrame: each variable’s own distribution on the diagonal, and a scatter plot (by default) for each pair of variables everywhere else. This guide covers the exact signature and defaults in seaborn 0.13.2, a worked example that runs as written, how to read the grid, and the point at which you should move to PairGrid. Parameters and defaults were checked against the seaborn documentation on 2026-10-29.
What pairplot is used for in research
A pair plot is a first look at a dataset with several numeric variables. In one figure you can see how each variable is distributed and whether any two variables appear related, before you commit to a model or a correlation test. It suits exploratory analysis of tidy data: the seaborn documentation describes the input as a “tidy (long-form) dataframe where each column is a variable and each row is an observation.”
The seaborn tutorial puts the trade-off plainly: PairGrid is flexible, but to take a quick look at a dataset it can be easier to use pairplot(), which “trades off some flexibility for faster plotting.” If you are building a wider exploratory workflow, see Python for exploratory data analysis; for a single pair of variables, scatter plots in Python is the narrower tool.
Install or access
seaborn is installed from its official channels (installation page for 0.13.2):
pip install seaborn
pip install seaborn[stats]
conda install seaborn
conda install seaborn -c conda-forge
The required dependencies are numpy, pandas and matplotlib. The optional ones listed on the same page are statsmodels (for advanced regression plots), scipy and fastcluster. The documentation notes that the default conda channel may lag behind the conda-forge release.
Step-by-step: draw a pair plot
This example uses the penguins example dataset, which sns.load_dataset() fetches by name. Loaded as shown, it is a pandas DataFrame with 344 rows and 7 columns: species, island, bill_length_mm, bill_depth_mm, flipper_length_mm, body_mass_g and sex.
- Import seaborn and load the data:
import seaborn as sns penguins = sns.load_dataset("penguins") - Draw the default grid:
g = sns.pairplot(penguins)The result is a 4 by 4 grid, because only the four numeric columns are used. The text columns
species,islandandsexare left out. The documentation states the rule: ifvarsis not given, seaborn uses every column with a numeric data type. - Colour the points by group with
hue:g = sns.pairplot(penguins, hue="species")Passing
huealso changes the diagonal: with the defaultdiag_kind="auto", seaborn chooses the diagonal plot according to whetherhueis used. For colours, see seaborn colour palettes and thepaletteargument. - Restrict the variables with
vars, or make a non-square grid withx_varsandy_vars:sns.pairplot(penguins, vars=["bill_length_mm", "flipper_length_mm"]) sns.pairplot(penguins, x_vars=["bill_length_mm", "bill_depth_mm"], y_vars=["body_mass_g"], kind="reg", height=3)The first call produces a 2 by 2 grid; the second a 1 by 2 grid.
- Keep only the lower triangle with
corner=True, which leaves the upper off-diagonal triangle without axes:sns.pairplot(penguins, hue="species", corner=True) - Save the figure.
pairplot()returns the underlyingPairGrid, which has asavefigmethod:g = sns.pairplot(penguins, hue="species") g.savefig("penguins-pairplot.png")
Parameter reference
The full signature in 0.13.2 is seaborn.pairplot(data, *, hue=None, hue_order=None, palette=None, vars=None, x_vars=None, y_vars=None, kind='scatter', diag_kind='auto', markers=None, height=2.5, aspect=1, corner=False, dropna=False, plot_kws=None, diag_kws=None, grid_kws=None, size=None).
| You want to… | Use | Default and detail |
|---|---|---|
| Choose the off-diagonal plot | kind |
Default 'scatter'; the other options are 'kde', 'hist' and 'reg'. |
| Choose the diagonal plot | diag_kind |
Default 'auto', which depends on whether hue is used; also 'hist', 'kde' or None. |
| Limit or reshape the grid | vars, x_vars, y_vars |
Without vars, every numeric column is used (as the documentation puts it, every column with a numeric datatype). x_vars and y_vars give a non-square grid. |
| Resize panels | height, aspect |
height=2.5 (inches per facet); width is aspect * height, with aspect=1. |
| Remove the redundant half | corner |
Default False; True leaves the upper off-diagonal triangle empty. |
| Control missing values | dropna |
Default False. |
| Pass options to the plots | plot_kws, diag_kws, grid_kws |
plot_kws goes to the bivariate function, diag_kws to the univariate function, grid_kws to the PairGrid constructor. |
| Set marker shapes per group | markers |
A single matplotlib marker, or a list matching the number of hue levels. |
Output and how to read it
The function returns a PairGrid, so the figure can be adjusted afterwards. The grid has one row and one column per variable. A panel on the diagonal shows that single variable’s distribution (a histogram or density estimate). A panel off the diagonal shows the two variables named by its row and column; the panel in row i, column j is the mirror image of the one in row j, column i, with the axes swapped. That redundancy is why corner=True loses no information.
Use the diagonal to spot skew, outliers or several modes in a variable, and the off-diagonal panels to spot a roughly linear trend, a curve, or separate clusters when hue is set. A visible trend is a prompt for a closer look, not a result: quantify it with a measure such as the correlation coefficient, and see bivariate data for how paired measurements are treated. When you want a single summary of pairwise correlations instead of a grid of panels, a seaborn heatmap is the usual companion.
Troubleshooting
A column I expected is missing from the grid
Only numeric columns are plotted unless you pass vars. In the penguins example, species, island and sex never appear as axes. Use a categorical column as hue instead.
My hue column is numeric
The PairGrid documentation advises that when you use seaborn functions that can apply a numeric hue mapping, you will want to disable the mapping of the variable on the diagonal axes. If you need that level of control, build the grid directly (next section).
I need different plots above and below the diagonal
pairplot() is, in the documentation’s words, “a high-level interface for PairGrid that is intended to make it easy to draw a few common styles.” When you need more flexibility, use PairGrid directly. The grid object provides map_diag, map_offdiag, map_lower, map_upper and map, plus add_legend():
g = sns.PairGrid(penguins, hue="species")
g.map_diag(sns.histplot)
g.map_offdiag(sns.scatterplot)
g.add_legend()
The same code with corner=True and map_lower draws only the lower triangle with a custom plot. The PairGrid documentation uses diag_sharey=False in examples where the diagonal and the triangles use different functions.
Free alternatives and next steps
seaborn is open source and free to install. Within the same library, the choice is between the two interfaces below.
| Option | When it fits | Source |
|---|---|---|
sns.pairplot() |
A quick overview with scatter, kde, hist or reg panels and a few common styles. | seaborn.pairplot documentation |
sns.PairGrid |
Different functions on the diagonal, lower and upper triangles, or any custom mapping. | seaborn.PairGrid documentation |
seaborn draws with matplotlib; see seaborn vs matplotlib to decide when to work at each level.
FAQ
What is the difference between seaborn pairplot and PairGrid?
pairplot() is the high-level function and returns a PairGrid. Use PairGrid directly when you need to map different functions to the diagonal, lower and upper parts of the grid.
How do I show only the lower triangle?
Pass corner=True to sns.pairplot(). The upper off-diagonal triangle is then left without axes.
How do I choose which columns are plotted?
Pass a list to vars. For a rectangular grid, pass lists to x_vars and y_vars.
How do I change the plot type?
Set kind to 'scatter', 'kde', 'hist' or 'reg' for the off-diagonal panels, and diag_kind to 'hist', 'kde' or None for the diagonal.
How do I make the panels bigger?
Increase height (default 2.5 inches per facet). Width is aspect times height.
Sources
- seaborn.pairplot, seaborn 0.13.2 documentation, https://seaborn.pydata.org/generated/seaborn.pairplot.html (checked 2026-10-29)
- seaborn.PairGrid, seaborn 0.13.2 documentation, https://seaborn.pydata.org/generated/seaborn.PairGrid.html (checked 2026-10-29)
- Building structured multi-plot grids, seaborn tutorial, https://seaborn.pydata.org/tutorial/axis_grids.html (checked 2026-10-29)
- Installing seaborn, https://seaborn.pydata.org/installing.html (checked 2026-10-29)







