Loading [MathJax]/extensions/tex2jax.js

Monday, May 8, 2017

Hail Seaborn!

The seaborn heatmap perhaps is the best visualization of the correlations in a data set.




 Much better than Axes.matshow():




import seaborn as sns
def plot_corr(data, sz=10):
corr = data.corr()
fig, ax = plt.subplots(figsize=(sz,sz)) # Sample figsize in inches
sns.heatmap(corr,
xticklabels=corr.columns.values,
yticklabels=corr.columns.values, ax=ax)
def plot_corr2(df,size=10):
corr = df.corr()
fig, ax = plt.subplots(figsize=(size, size))
ax.matshow(corr)
plt.xticks(range(len(corr.columns)), corr.columns);
plt.yticks(range(len(corr.columns)), corr.columns);
view raw plot_corr.py hosted with ❤ by GitHub

No comments: