[英]Plotting frequency distribution/histogram with frequency table
我熟悉 matplotlib 直方圖參考:
http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.hist
但是,我實際上沒有原始系列/數據可以傳遞到情節中。 我只有 DataFrame 中的摘要統計信息。 例子:
df
lower upper occurrences frequency
0.0 0.5 17 .111
0.5 0.1 65 .426
0.1 1.5 147 .963
1.5 2.0 210 1.376
.
.
.
您不想在這里計算直方圖,因為您已經有了直方圖數據。 因此,您可以簡單地繪制一個條形圖。
fig, ax = plt.subplots()
ax.bar(df.lower, df.occurences, width=df.upper-df.lower, ec="k", align="edge")
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.