Changing Line Width with Seaborn distplot

Question:

I don’t find a way to change the line width for one of my sub plots. I have the following which should change the line width of the fitted line, but does not appear to do anything.

sns_plot = sns.distplot(distribution, fit_kws=dict(linewidth=2.5))
Asked By: disruptive

||

Answers:

For a distplot, you can pass arguments to the underlying plotting functions with the {hist, kde, rug, fit}_kws dictionaries as described in the official documentation.

If you want to change the line width of a fit you may use fit_kws; but by default distplot shows a kernel density estimate (KDE) as line. To change the line properties of the kde curve hence use kde_kws instead of fit_kws:

sns_plot = sns.distplot(distribution, kde_kws=dict(linewidth=5))
Answered By: Nils Schlüter

I manually played with hist_kws={‘rwidth’:3} and bins=x to get more or less same thickness bars as others in my plot.

Answered By: ncuxomun
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.