weights option for seaborn distplot?

前端 未结 2 1465
渐次进展
渐次进展 2020-12-18 20:37

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

2条回答
  •  时光说笑
    2020-12-18 21:20

    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.

提交回复
热议问题