I am creating a histrogram (frecuency vs. count) and I want to add kernel density estimate line in a different colour. How can I do this? I want to change the colour for example
sns.histplot(data=penguins, x="flipper_length_mm", kde=True)
Example taken from https://seaborn.pydata.org/generated/seaborn.histplot.html

histplot'sline_kws={...}is meant to change the appearance of the kde line. However, the current seaborn version doesn't allow changing the color that way, probably because the color goes together with thehueparameter (althoughhueisn't used in this case).In seaborn's github, it is suggested to draw the
histplotand thekdeplotseparately. For both to match in the y-direction, it is necessary to usehistplotwithstat='density'(thekdeplotdoesn't have a parameter to usehistplot's defaultstat='count').If the
countstatistics is really needed, an alternative is to change the line color via matplotlib: