grouped = df.groupby('a')
rowlength = grouped.ngroups / 2
fig, axs = plt.subplots(figsize=(9, 4), nrows=2, ncols=rowlength)
targets = zip(list(grouped.groups.keys()), axs.flatten())
for i, (key, ax) in enumerate(targets):
    sns.heatmap(grouped.get_group(key).corr(), ax=ax, xticklabels=i >=
        rowlength, yticklabels=i % rowlength == 0, cbar=False)
ax.set_title('a=%d' % key)
plt.show()
Plotting correlation heatmaps with Seaborn FacetGrid