# 相关矩阵图
from
pandas import read_csv import matplotlib.pyplot as plt import numpy as np filename = 'pima_data.csv' names = ['preg', 'plas', 'pres', 'skin', 'test', 'mass', 'pedi', 'age', 'class'] data = read_csv(filename, names=names) correlations = data.corr() fig = plt.figure() ax = fig.add_subplot(111) cax = ax.matshow(correlations, vmin=-1, vmax=1) fig.colorbar(cax) ticks = np.arange(0, 9, 1) ax.set_xticks(ticks) ax.set_yticks(ticks) ax.set_xticklabels(names) ax.set_yticklabels(names) plt.show()

相关矩阵图 与散点矩阵图

散点矩阵图

 

from pandas import read_csv
import matplotlib.pyplot as plt
from pandas.plotting import scatter_matrix
filename = 'pima_data.csv'
names = ['preg', 'plas', 'pres', 'skin', 'test', 'mass', 'pedi', 'age', 'class']
data = read_csv(filename, names=names)
scatter_matrix(data)
plt.show()

相关矩阵图 与散点矩阵图

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-04
  • 2021-11-17
  • 2021-12-06
猜你喜欢
  • 2022-01-22
  • 2022-12-23
  • 2021-12-29
  • 2022-12-23
  • 2021-08-27
相关资源
相似解决方案