Correlation Matrix Plots

In [3]:
# Correction Matrix Plot (generic)

from matplotlib import pyplot
from pandas import read_csv

filename = 'pima-indians-diabetes.data.csv'

names = ['preg', 'plas', 'pres', 'skin', 'test', 'mass', 'pedi', 'age', 'class']

data = read_csv(filename, names=names)

correlations = data.corr()

# plot correlation matrix
fig = pyplot.figure(figsize = (15,15))
ax = fig.add_subplot(111)
cax = ax.matshow(correlations, vmin=-1, vmax=1)
fig.colorbar(cax)
pyplot.show()
In [ ]: