Reputation: 656
My understanding is that the below code shall produce histograms in the diagonal boxes. Instead, I am getting density curves? Why is this? If I remove 'hue','palette' and 'diag_kws', it produces histograms as expected. Any inputs?
sns.pairplot(data=ins_pre,
vars=["fatal_collisions", "premiums",'insurance_losses'],
kind='scatter',
hue='Region',
palette='RdBu',
diag_kws={'alpha':.5})
plt.show()
plt.clf()
Plot the same data but remove 'hue','palette' and 'diag_kws'
sns.pairplot(data=ins_pre,
vars=["fatal_collisions", "premiums",'insurance_losses'],
kind='scatter')
plt.show()
plt.clf()
Upvotes: 3
Views: 3517
Reputation: 9481
from the documentation:
seaborn.pairplot(data, hue=None, hue_order=None, palette=None, vars=None, x_vars=None, y_vars=None, kind='scatter', diag_kind='auto', markers=None, height=2.5, aspect=1, corner=False, dropna=True, plot_kws=None, diag_kws=None, grid_kws=None, size=None) [...] diag_kind{‘auto’, ‘hist’, ‘kde’, None}, optional Kind of plot for the diagonal subplots. The default depends on whether "hue" is used or not.
So, you should call the function like so:
sns.pairplot(data=ins_pre,
vars=["fatal_collisions", "premiums",'insurance_losses'],
kind='scatter',
hue='Region',
palette='RdBu',
diag_kind='hist')
Upvotes: 2