![](/img/trans.png)
[英]Python matplotlib histogram: edit x-axis based on maximum frequency in bin
[英]python histogram how to find the midpoint of bin with the maximum frequency
我想找到頻率最高的 bin 的中點。 我如何獲得價值?
使用 matplotlib 我用代碼繪制直方圖:
num_bins = 25
weights = (1 / data['day'].shape[0]) * np.ones_like(data['day'])
n, bin_cuts, patches = plt.hist(data['day'], num_bins, weights=weights)
並得到這個 25 個 bin 的直方圖。 我使用 .max() 但它給出了整個數據的唯一最大點。
嘗試使用 -
0.5 * ( edges[1:] + edges[:-1] )
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.