Does Seaborn distplot not support range?

I have a data array called data1 that contains values ​​from 0 to over a thousand. I only want to have a histogram and KDE of these values ​​from 0 to 10. Therefore, I wrote:

sns.distplot(data1, kde=True, hist=True, hist_kws={"range": [0,10]}) plt.show() 

However, I get a histogram of all values ​​(in the 2000s).

+5
source share
1 answer

You can simply filter your data and call displot on the filtered data:

 filtered = data1[(data1 >= 0) & (data1 < 10)] sns.distplot(filtered, kde=True, hist=True, hist_kws={"range": [0,10]}) plt.show() 

Assuming data1 is a numpy array.

+4
source

All Articles