- #73 Control bandwidth of density plot
- #73 Control bandwidth of density plot
These 2 density plots have been made using the same data. Only the bandwidth changes from 0.5 on the left to 0.05 on the right. This is controlled using the bw argument of the kdeplot function (seaborn library).
# library & dataset import seaborn as sns df = sns.load_dataset('iris') # Large bandwidth sns.kdeplot(df['sepal_width'], shade=True, bw=.5, color="olive") #sns.plt.show() # Narrower bandwidth sns.kdeplot(df['sepal_width'], shade=True, bw=.05, color="olive") #sns.plt.show()