问题
I'd like to have a weights option in seaborn distplot, similar to that in numpy histogram. Without this option, the only alternative would be to apply the weighting to the input array, which could result in an impractical size (and time).
回答1:
You can provide weights by passing them to the underlying matplotlib's histogram function using the hist_kws argument, as:
sns.distplot(..., hist_kws={'weights': your weights array}, ...)
Take note though, that the weights will be passed only to the underlying histogram; neither the kde, nor the fit functions of the distplot will be affected.
来源:https://stackoverflow.com/questions/31703149/weights-option-for-seaborn-distplot