I am looking at the iris data set (Fisher 1936). e.g. https://www.kaggle.com/uciml/iris/downloads/Iris.csv
Creating the seaborn pairplot with the arguments
There was an the issue with producing hues on the diagonal of sns.pairplot
. This issue is now fixed in version 0.8.1 of seaborn.
In case one is still interested, the following may be a workaround. You may create the underlying PairGrid
yourself and map the diagonal and the off_diagonal elements individually. For the diagonal elements, get a color from the current cycler first, then use this color for the kdeplot
.
import matplotlib.pyplot as plt
import seaborn as sns
iris = sns.load_dataset("iris")
g = sns.PairGrid(iris, hue='species', size=2)
def f(x, **kwargs):
kwargs.pop("color")
col = next(plt.gca()._get_lines.prop_cycler)['color']
sns.kdeplot(x, color=col, **kwargs)
g.map_diag(f)
g.map_offdiag(plt.scatter)
g.add_legend()
plt.show()