change the seaborn pairplot diagonal color

Question:

When using the sns.pairplot I have this:

import seaborn as sns

iris = sns.load_dataset("iris")

g = sns.pairplot(iris, 
                 markers="+",
                 kind='reg',
                 diag_kind="kde",
                 plot_kws={'line_kws':{'color':'#aec6cf'}, 
                           'scatter_kws': {'alpha': 0.5, 
                                           'color': '#82ad32'}},
                 corner=True)

Pairplot without kde colors:

enter image description here

But I need to change the diagonal color of the plot, but when I try diag_kws, I have the following error:

import seaborn as sns

iris = sns.load_dataset("iris")

g = sns.pairplot(iris, 
                 markers="+",
                 kind='reg',
                 diag_kind="kde",
                 plot_kws={'line_kws':{'color':'#aec6cf'}, 
                           'scatter_kws': {'alpha': 0.5, 
                                           'color': '#82ad32'}, 
                           'diag_kws': {'color': '#82ad32'}},
                 corner=True)

TypeError: regplot() got an unexpected keyword argument 'diag_kws'
Asked By: kovashikawa

||

Answers:

You should specify the diag_kws as a parameter of pairplot itself, not as a key of the plot_kws parameter, like this:

g = sns.pairplot(iris,
                 markers="+",
                 kind='reg',
                 diag_kind="kde",
                 plot_kws={'line_kws':{'color':'#aec6cf'},
                           'scatter_kws': {'alpha': 0.5,
                                           'color': '#82ad32'}},
                 corner=True,
                 diag_kws= {'color': '#82ad32'})

enter image description here

Answered By: Zephyr