I'm looking for a way to plot a distribution histogram, with the y-axis
representing the total number of items for each bin (and not just the count).
Example on the charts below:
It's not as trivial as it looks because one can't simply multiply each bin's count by the bin's value (maybe in the 20-30 bin, there are 54 agencies who sold 21 are 1 who sold 29).
Questions:
matplotlib
or seaborn
?You want to use the weights
kwarg (see numpy docs) which is passed through ax.hist
(see).
Something like
fig, ax = plt.subplots()
ax.hist(num_sold, bins, weights=num_sold)