Issue
I have an array of data, called data1, that contains values from 0 to more than a thousand. I only want to have a histogram and a KDE of those values from 0 to 10. Hence I wrote:
sns.distplot(data1, kde=True, hist=True, hist_kws={"range": [0,10]})
plt.show()
What I get however is a histogram of all values (well into 2000s).
Solution
You could just filter your data and call displot
over 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.
Answered By - Imanol Luengo
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.