2017-07-18 140 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")