pandas.plotting.scatter_matrix

pandas 3.1.1 · Plotting · function

Draw pairwise scatter plots and univariate plots for numeric DataFrame columns.

Call syntax

pd.plotting.scatter_matrix(…) Full signature
pd.plotting.scatter_matrix(
    frame,
    alpha=0.5,
    figsize=None,
    ax=None,
    grid=False,
    diagonal='hist',
    marker='.',
    density_kwds=None,
    hist_kwds=None,
    range_padding=0.05,
    **kwargs,
)

Inspect the call

Run this code to inspect the callable and its parameters. Its data, backend, or environment is needed to execute the operation itself.

Parameters

ParameterRequirementAccepted values and behavior
frame Required
Positional or keyword
DataFrame

Supply the DataFrame the function processes.

alpha Optional
Positional or keyword
Default 0.5
float

Supply the factor controlling the rate of weight decay, or a transparency for a plot.

figsize Optional
Positional or keyword
Default None
(float,float)

Set the figure width and height as a pair, in inches.

ax Optional
Positional or keyword
Default None
Matplotlib axis object

Provide the existing Matplotlib axes on which to draw.

grid Optional
Positional or keyword
Default False
bool

Choose whether the plot displays grid lines.

diagonal Optional
Positional or keyword
Default 'hist'
{'hist', 'kde'}
marker Optional
Positional or keyword
Default '.'
str
density_kwds Optional
Positional or keyword
Default None
keywords
hist_kwds Optional
Positional or keyword
Default None
keywords
range_padding Optional
Positional or keyword
Default 0.05
float
**kwargs Optional
Additional keyword arguments

Returns

numpy.ndarray

Example for a local Python session

import pandas as pd
import matplotlib
frame = pd.DataFrame({"team": ["A", "A", "B"], "units": [2., 5., 7.], "price": [4., 3., 2.]})
print(pd.plotting.scatter_matrix(frame))