Python 为什么在使用matplotlib直方图模块时,len(bin)和numb_bin的值不同?

Python 为什么在使用matplotlib直方图模块时,len(bin)和numb_bin的值不同?,python,matplotlib,histogram,Python,Matplotlib,Histogram,我使用文件中的数据生成了一个直方图。然而,当我打印len(bins)时,它与bins的数量不同吗 with open ('EHSS.dat') as f: data = [line.rstrip() for line in f] x = [ float(i) for i in data] num_bins = 7 plt.figure(0) n, bins, patches = plt.hist(x, num_bins, facecolor='purple', alpha=

我使用文件中的数据生成了一个直方图。然而,当我打印len(bins)时,它与bins的数量不同吗

with open ('EHSS.dat') as f:
        data = [line.rstrip() for line in f]

x = [ float(i) for i in data]

num_bins = 7

plt.figure(0)
n, bins, patches = plt.hist(x, num_bins, facecolor='purple', alpha=0.5)
plt.savefig('fig0.png')

print(len(bins), num_bins)
这段代码给出len(bins)=8,num_bins=7,这是为什么?

我在

存储箱:阵列

垃圾箱的边缘长度nbins+1(nbins最后一个箱子的左边缘和右边缘)。即使传入多个数据集,也始终使用单个数组

我在桌子上找到了这个

存储箱:阵列

垃圾箱的边缘长度nbins+1(nbins最后一个箱子的左边缘和右边缘)。即使传入多个数据集,也始终使用单个数组