How to plot a jointplot with 'hue' parameter in seaborn
You can't, unfortunately
and it won't be implemented in the near future, because the simplicity of jointplot should be preserved.
See here: https://github.com/mwaskom/seaborn/issues/365
You can only do it halfway (without the hist for both classes): Plotting two distributions in seaborn.jointplot
This functionality was added in the v0.11 Seaborn release in September 2020 (see e. g. the release blog post or the documentation).
The documentation now features a great example based on the penguins dataset:
penguins = sns.load_dataset("penguins")
sns.jointplot(data=penguins, x="bill_length_mm", y="bill_depth_mm", hue="species")
I further would like to give a minimal example for a Kernel density estimation in the joint plot (a 2d kdeplot):
# optional: sns.set(style='darkgrid')
data = {'x': [1, 2, 3, 4, 5, 6],
'y': [2, 4, 1.5, 4, 3, 5],
'class': ['1', '1', '1', '0', '0', '0']}
sns.jointplot(data=data, x='x', y='y', hue='class', kind='kde',
fill=True, joint_kws={'alpha': 0.7})
A simple alternative is to use seaborn.lmplot
-- even if x and y histogram are not drawn.
sns.lmplot(x='total_bill', y='tip', hue='sex', data=tips, fit_reg=False)