Friday, June 18, 2021

【PYTHON】Pairplots and Correlograms

 sns.pairplot(data=df)


# save figure for book

f = plt.figure(figsize=(5.5, 5.5))  # this changes the size of the image -- more on this is chapter 5

f.patch.set_facecolor('w')  # sets background color behind axis labels

sns.pairplot(data=df)

plt.tight_layout()  # auto-adjust margins

plt.savefig('B17030_05_10.png', dpi=300)


sns.heatmap(df.corr(), annot=True)


# save figure for book

f = plt.figure(figsize=(5.5, 5.5))  # this changes the size of the image -- more on this is chapter 5

f.patch.set_facecolor('w')  # sets background color behind axis labels

sns.heatmap(df.corr(), annot=True)

plt.tight_layout()  # auto-adjust margins

plt.savefig('B17030_05_11.png', dpi=300)


sns.heatmap(df.corr(method='spearman'), annot=True)


# save figure for book

f = plt.figure(figsize=(5.5, 5.5))  # this changes the size of the image -- more on this is chapter 5

f.patch.set_facecolor('w')  # sets background color behind axis labels

sns.heatmap(df.corr(method='spearman'), annot=True)

plt.tight_layout()  # auto-adjust margins

plt.savefig('B17030_05_12.png', dpi=300)

No comments:

Post a Comment