Draw a matrix of scatter plots.
Amount of transparency applied.
A tuple (width, height) in inches.
Setting this to True will show the grid.
Pick between ‘kde’ and ‘hist’ for either Kernel Density Estimation or Histogram plot in the diagonal.
Matplotlib marker type, default ‘.’.
Keyword arguments to be passed to kernel density estimate plot.
Keyword arguments to be passed to hist function.
Relative extension of axis range in x and y with respect to (x_max - x_min) or (y_max - y_min).
Keyword arguments to be passed to scatter function.
A matrix of scatter plots.
Examples
>>> df = pd.DataFrame(np.random.randn(1000, 4), columns=['A','B','C','D'])
>>> pd.plotting.scatter_matrix(df, alpha=0.2)
array([[<Axes: xlabel='A', ylabel='A'>, <Axes: xlabel='B', ylabel='A'>,
<Axes: xlabel='C', ylabel='A'>, <Axes: xlabel='D', ylabel='A'>],
[<Axes: xlabel='A', ylabel='B'>, <Axes: xlabel='B', ylabel='B'>,
<Axes: xlabel='C', ylabel='B'>, <Axes: xlabel='D', ylabel='B'>],
[<Axes: xlabel='A', ylabel='C'>, <Axes: xlabel='B', ylabel='C'>,
<Axes: xlabel='C', ylabel='C'>, <Axes: xlabel='D', ylabel='C'>],
[<Axes: xlabel='A', ylabel='D'>, <Axes: xlabel='B', ylabel='D'>,
<Axes: xlabel='C', ylabel='D'>, <Axes: xlabel='D', ylabel='D'>]],
dtype=object)
© 2008–2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
© 2011–2025, Open source contributors
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/2.3.0/reference/api/pandas.plotting.scatter_matrix.html