I'm trying to create a kde plot using seaborn in python but when setting the colorbar values to show in scientific notation I see no difference.
See - making colorbar with scientific notation in seaborn for a heavily related topic.
See - https://seaborn.pydata.org/generated/seaborn.kdeplot.html for the documentation of seaborn's kde class.
Is there some reason why this doesn't work for the kde class or am I making a silly mistake in my formatting?
import numpy as np
import seaborn as sns
import matplotlib.ticker as tkr
a = np.random.normal(0,1,size=100)
b = np.random.normal(0,1,size=100)
fig, ax = plt.figure(), plt.subplot(111)
formatter = tkr.ScalarFormatter(useMathText=True)
formatter.set_scientific(True)
sns.kdeplot(a,b, n_levels=10, shade=True, cmap='Blues',
cbar=True, cbar_kws={'format':formatter})
The result:
Here I would be expecting the colourbar to show an indexed notation as in the first link in the description of this problem.