When generating bivariate plots like hexbin
, pandas generates a legend explaining frequency value for each color shade:
pokemon.plot.hexbin(x='HP', y='Attack', gridsize=30)
I cannot find a similar way to generate such a legend for jointplot
and kdeplot
in seaborn:
sns.jointplot(data=pokemon, x='HP', y='Attack', kind='hex')
sns.kdeplot(pokemon['HP'], pokemon['Attack'], shade=True)
How can I do it?
for a kdeplot, simply pass cbar=True
cbar : bool, optional
If True and drawing a bivariate KDE plot, add a colorbar.
import seaborn as sns
g = sns.jointplot(data=sns.load_dataset("penguins"), x="bill_length_mm", y="bill_depth_mm",
kind="kde", cbar=True, fill=True, height=8)