相关疑难解决方法(0)

累积直方图的最后一点在y = 0

我正在创建直方图

pylab.hist(data,weights,histtype='step',normed=False,bins=150,cumulative=True)
Run Code Online (Sandbox Code Playgroud)

得到(还有其他的情节,现在是无关紧要的)紫罗兰色的线条

直方图

为什么直方图再次降到零?累积函数通常应该是非递减的.有没有办法解决这个问题,无论是错误还是功能?

编辑:解决方案(黑客):

# 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])
Run Code Online (Sandbox Code Playgroud)

matplotlib histogram

12
推荐指数
1
解决办法
1997
查看次数

标签 统计

histogram ×1

matplotlib ×1