I'm trying to make a pairplot of kind scatter plot with histogram diagonals, but when adding a hue the histograms become invalid.
My code before hue:
import seaborn as sn
sn.pairplot(dropped_data)
My code after adding hue:
sn.pairplot(dropped_data, hue='damage rating')
What I have tried:
sn.pairplot(dropped_data, hue='damage rating', diag_kind='hist', kind='scatter')
As you can see, when using a hue, the diagonal histogram it goes all weird and becomes incorrect. How can I fix this?




It looks like the hue column is continuous and contains only unique values. As the diagonal is build up of
kdeplots, those won't work when each kde is build from only one value.One way to tackle this, is using stacked
histplots. This might be slow when a lot of data is involved.Another approach is to make the hue column discrete, e.g. by rounding them.
A reproducible example
First, let's try to recreate the problem with easily reproducible data:
Working with a stacked histogram
Making the hue column discrete via rounding: