11
votes

In pyplot's hist() function, we are able to access the values of the histogram bins (through the return n); is it possible to access this same information from Seaborn's distplot? Seaborn only returns an axis object.

Ultimately, I'd like juxtapose a line plot on top of the histogram which sums the counts in the bins.

1
ax.hist(yourdata) ? - fgoettel
Or better yet use numpy.histogram - mwaskom
yeah i was looking at numpy.histogram is that what's being called in the backend by seaborn? - Constantino
seaborn is just using the matplotlib histogram function, but I think that probably uses numpy behind the scenes (or anyway numpy will give the same answer). - mwaskom

1 Answers

9
votes

For completeness, numpy.histogram is what I was looking for!