数据之间,数据和结局指标之间的相关性用python可以直观展示。 加载数据和模块 import pandas as pd import numpy as np import warnings %matplotlib inline warnings.filterwarnings('ignore') df = pd.read_csv('eicu-corr-20201012.csv') #加载模块import seaborn as snsimport matplotlib.pyplot as pltsns.set(color_codes=True) 结果展示 fgure, ax = plt.subplots(figsize=(36,30)) sns.heatmap(df.corr(), square=True, annot=True, ax=ax) 调整颜色和间距 figure, ax = plt.subplots(figsize=(36,30))sns.heatmap(df.corr(), square=True, annot=True,linewidths=0.2, cmap='YlGnBu', ax=ax) figure, ax = plt.subplots(figsize=(36,30)) sns.heatmap(df.corr(), square=True, annot=True,linewidths=0.2, cmap='Accent', ax=ax) 加入图片名称 figure, ax = plt.subplots(figsize=(36,30),dpi=80)sns.heatmap(df.corr(), square=True, annot=True,linewidths=0.2, cmap='RdYlGn', ax=ax)plt.title('Correlogram of mtcars', fontsize=22) |
|
来自: Candyh6po6h61g > 《待分类》