0

The following code should produce two identical histograms overlapping.

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()

However, it fails on the line starting with "plt1 = ax.bar" with the following error:

...
 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' 

This appears to be an issue with both Enthought's Canopy and the Macport of matplotlib after looking online. As no one else is reporting this bug on the matplotlib mailing lists I think it comes from the configuration used by Macports and Enthought.

4

1 回答 1

0

在 Canopy 1.0.3 下,我看到 matplotlib 1.2.1 相同,但 matplotlib 1.2.0 没有。不能确定,但​​考虑到这一点,并且考虑到它在 Macports 中的出现,这很可能是一个 matplotlib 回归。添加 matplotlib 标签。

于 2013-07-22T23:03:04.630 回答