我創建直方圖累積的柱狀圖具有爲y最後一點= 0
pylab.hist(data,weights,histtype='step',normed=False,bins=150,cumulative=True)
得到(還有其他的地塊,現在是無關緊要的)紫線
爲什麼直方圖再次下降到零?累積函數應該一般不減少。有沒有辦法解決這個問題,無論是錯誤還是功能?
編輯:溶液(黑客):
# histtype=step returns a single patch, open polygon
n,bins,patches=pylab.hist(data,weights,histtype='step',cumulative=True)
# just delete the last point
patches[0].set_xy(patches[0].get_xy()[:-1])
這工作! Vielen Dank –