I was trying to plot a histogram with kernel density estimator using seaborn. First I used seaborn.distplot, but I got a warning that 'distplot is a deprecated function and will be removed in a future version.'
So I used seaborn.histplot, but when I used the same argument kde_kws=dict(linewidth = 2 , color = 'black'), I got an error 'unexpected keyword argument 'linewidth' and 'color'.
But I checked the documents showing that the argument in the two functions is seems used in the same way that the argument is passed to seaborn.kdeplot(). And this function seaborn.kdeplot() indeed has the argument 'color'. So my question is why it works on distplot, but fails to work on histplot?
sb.distplot(sn2, bins = 10, kde = True, color = 'teal', kde_kws=dict(linewidth = 2 , color = 'black'))
sb.histplot(sn2, bins = 10, kde = True, color = 'teal', kde_kws = dict(linewidth = 2, color = 'red'))
Meanwhile, when I used argument line_kws = dist(linewidth = 2, color = 'red'), I got no error. And it succeeded in changing the linewidth but failed to change the color.
sb.histplot(sn2, bins = 10, kde = True, color = 'teal', line_kws = dict(linewidth = 2, color = 'red'))
enter image description here Can anyone explain to me why this happened? Thank you in advance.