Scatter Plot Matrix

A function to conveniently plot stacked bar plots in matplotlib using pandas DataFrames.

from mlxtend.plotting import scatterplotmatrix

Overview

A matplotlib convenience function for creating a scatterplot matrix.

References

Example 1 - Simple Scatter Plot Matrix

import matplotlib.pyplot as plt
from mlxtend.data import iris_data
from mlxtend.plotting import scatterplotmatrix


X, y = iris_data()
scatterplotmatrix(X, figsize=(10, 8))
plt.tight_layout()
plt.show()

png

Example 2 - Scatter Plot Matrix with Multiple Categories

names = ['sepal length [cm]', 'sepal width [cm]',
         'petal length [cm]', 'petal width [cm]']

fig, axes = scatterplotmatrix(X[y==0], figsize=(10, 8), alpha=0.5)
fig, axes = scatterplotmatrix(X[y==1], fig_axes=(fig, axes), alpha=0.5)
fig, axes = scatterplotmatrix(X[y==2], fig_axes=(fig, axes), alpha=0.5, names=names)

plt.tight_layout()
plt.show()

png

API

scatterplotmatrix(X, fig_axes=None, names=None, figsize=(8, 8), alpha=1.0, kwargs)

Lower triangular of a scatterplot matrix

Parameters

Returns