Python - Correlation Coefficient Plot

Python draws a heat map of the correlation coefficient. 

import matplotlib.pyplot as plt
import seaborn as sns

train_corr = data_train1.corr() #计算相关系数

ax = plt.subplots(figsize=(20, 16)) #调整画布大小
cmap = sns.diverging_palette(180, 30, as_cmap=True)  #颜色
ax = sns.heatmap(train_corr, vmax=.8, cmap=cmap,square=True, annot=True)#画热力图 ,annot=True 显示系数

Guess you like

Origin blog.csdn.net/J__aries/article/details/130028952