Matplotlib: Scatter Plot Matrix

This recipe includes the following topics:

  • Draw a Scatter Plot Matrix


# import module
import pandas as pd
import matplotlib.pyplot as plt

fileGitURL = 'https://raw.githubusercontent.com/andrewgurung/data-repository/master/pima-indians-diabetes.data.csv'

# define column names
cols = ['preg', 'plas', 'pres', 'skin', 'test', 'mass', 'pedi', 'age', 'class']

# load file as a Pandas DataFrame
pimaDf = pd.read_csv(fileGitURL, names=cols)

# draw scatter plot matrix
pd.plotting.scatter_matrix(pimaDf, figsize=(15,15))
plt.show()

Scatter Plot Matrix
Fig: Scatter Plot Matrix

Leave a Reply

Your email address will not be published. Required fields are marked *