Jiv*_*van 3 python matplotlib histogram seaborn
我正在寻找一种绘制分布直方图的方法,y-axis代表每个bin的项目总数(而不仅仅是计数).
以下图表中的示例:
它并不像看起来那么微不足道,因为人们不能简单地将每个箱子的数量乘以箱子的价值(可能在20-30箱子中,有54个代理商卖出21个,其中1个卖出29个).
问题:
matplotlib或seaborn?你想使用weightkwarg(见numpy的文档),这是通过传递ax.hist(见).
就像是
fig, ax = plt.subplots()
ax.hist(num_sold, bins, weights=num_sold)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3227 次 |
| 最近记录: |