Skip to main content
v2026.11,858 entries · CC-BY 4.0
LAC HealthMedical & Research SuppliesReagents, PPE & instruments — chain-of-custody documented.Fast, traceable sourcing built for regulated research environments, from bench consumables to instrumentation.Shop lac.us CodeCASRAIlac.us

Seaborn Pairplot: sns.pairplot Syntax, Parameters and How to Read It

How to use seaborn pairplot: syntax, parameters and defaults in 0.13.2, a runnable penguins example, corner plots, and when to switch to PairGrid.

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.

  1. Import seaborn and load the data:
    import seaborn as sns
    penguins = sns.load_dataset("penguins")
  2. 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, island and sex are left out. The documentation states the rule: if vars is not given, seaborn uses every column with a numeric data type.

  3. Colour the points by group with hue:
    g = sns.pairplot(penguins, hue="species")

    Passing hue also changes the diagonal: with the default diag_kind="auto", seaborn chooses the diagonal plot according to whether hue is used. For colours, see seaborn colour palettes and the palette argument.

  4. Restrict the variables with vars, or make a non-square grid with x_vars and y_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.

  5. Keep only the lower triangle with corner=True, which leaves the upper off-diagonal triangle without axes:
    sns.pairplot(penguins, hue="species", corner=True)
  6. Save the figure. pairplot() returns the underlying PairGrid, which has a savefig method:
    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

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about Seaborn Pairplot: sns.pairplot Syntax, Parameters and How to Read It

Ask your first 2 questions free below. Subscribers get 150 a day for $29 a month.

An AI assistant specialized in research administration. It cites the sources behind every answer, labels web answers and says when it can't answer.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →