Plot a Basic Correlation Matrix using Seaborn

logo of a chart:Correlogram

This post aims to show how to plot a basic correlation matrix using seaborn.

Seaborn allows you to make a correlogram or correlation matrix really easily. Correlogram is awesome for exploratory analysis: it makes you quickly observe the relationship between every variable of your matrix. It is easy to do it with seaborn: just call the pairplot() function!

# libraries
import seaborn as sns
import matplotlib.pyplot as plt

# load data set
df = sns.load_dataset('iris')

# Basic correlogram
sns.pairplot(df)
plt.show()

Contact & Edit


👋 This document is a work by Yan Holtz. You can contribute on github, send me a feedback on twitter or subscribe to the newsletter to know when new examples are published! 🔥

This page is just a jupyter notebook, you can edit it here. Please help me making this website better 🙏!