How can remove the gaps between bars?

Question:

The code underneath works but my problem is that it prints spaces in between the bars in the histogram and I want zero space in between each bin. Any suggestion is appreciated – appreciation!

sns.histplot(stat='frequency',data=df, x="Water",color = "red", bins=10,
             alpha = 0.3, kde = True, line_kws = {'color':'red','linestyle': 'dashed'})

enter image description here

I want something like the below plot.

enter image description here

Asked By: delta classic

||

Answers:

Using edgecolor, which is passed through to Axes.bar. As an example:

import seaborn as sns
tips = sns.load_dataset('tips')

sns.histplot(stat='frequency', data=tips, x='total_bill', color='red', 
             kde=True, alpha=0.3, edgecolor=None, 
             line_kws = {'color':'red','linestyle': 'dashed'})

enter image description here

Or if you want an edge, then:

edgecolor='red'

enter image description here

Answered By: BigBen