2017-07-18 143 views
-1

我熟悉的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 
. 
. 
. 
+0

https://stackoverflow.com/questions/5926061/plot-histogram-in-python – Masoud

+0

https://stackoverflow.com/questions/22393959/r-histogram-from-frequency-table – Masoud

回答

2

你不想在這裏計算的直方圖,因爲你已經有了直方圖數據。因此,您可以簡單地繪製條形圖。

fig, ax = plt.subplots() 
ax.bar(df.lower, df.occurences, width=df.upper-df.lower, ec="k", align="edge")