0
以下代码应产生两个相同的直方图重叠。matplotlib 1.2.1与日志轴和条形失败
x = scipy.random.normal(0,1,100)
f = figure(num=1)
f.clear()
ax = f.add_subplot(111)
ns,bns,plt0 = ax.hist(x,bins=10,log=True)
plt1 = ax.bar(bns[0:-1],ns,width=bns[1:]-bns[0:-1],color='r',log=True)
draw()
但是,它未能上线开始“PLT1 = ax.bar”,出现以下错误:
...
File "/Users/xof/Documents/Dev/environments/tuneup/lib/python2.6/site-packages/matplotlib/transforms.py", line 786, in from_bounds
return Bbox.from_extents(x0, y0, x0 + width, y0 + height)
TypeError: unsupported operand type(s) for +: 'NoneType' and 'float'
这似乎与Enthought的植被与matplotlib的Macport两个问题在网上查找后。由于没有其他人在matplotlib邮件列表上报告这个错误,我认为它来自Macports和Enthought使用的配置。