I want to create a Kernel-Density-Estimation with Seaborn.kdeplot with a colorbar on the side.
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np; np.random.seed(10)
import seaborn as sns; sns.set(color_codes=True)
mean, cov = [0, 2], [(1, .5), (.5, 1)]
x, y = np.random.multivariate_normal(mean, cov, size=50).T
sns.kdeplot(x,y,shade=True)
plt.show()
While the Kernel-Density-Estimation is created, I do not have a clue how to create the colorbar. I tried using plt.colorbar() without success.
You'll have to call the scipy KDE and matplotlib contour function directly, but it's just a bit of extra code: