Reputation: 630
I am using sns.distplot with hist=True and kde=True. This works fine but for some datasets (e.g. if they contain only discrete values) the kernel density estimation line is zig-zagging which looks very odd given that the histogram underneath is smooth. A manual adjustment of the kde bandwidth should fix this but how can I set this for sns.distplot? The documentation does not say anything and the "bw" parameter that works for sns.kdeplot does not exist. How can I stop it from zig-zagging?
Upvotes: 0
Views: 5841
Reputation: 321
You can use the bandwidth option(bw) with the optional parameter "kde_kws" in the seaborn distplot to set the desired bandwidth.
eg : g = g.map(sns.distplot, "value", kde_kws={'bw':0.1})
Upvotes: 2