我有1247746130.列表大小我想对于这个列表中的直方图:内存错误
bins = np.linspace(-100, 1, 100)
plt.hist(refList, bins, alpha=0.5, label='reference')
plt.legend(loc='upper right')
plt.savefig('reference.png')
,但我得到一个错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 3081, in hist
stacked=stacked, data=data, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/matplotlib/__init__.py", line 1898, in inner
return func(ax, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/matplotlib/axes/_axes.py", line 6146, in hist
x = _normalize_input(x, 'x')
File "/usr/local/lib/python2.7/dist-packages/matplotlib/axes/_axes.py", line 6083, in _normalize_input
inp = np.asarray(inp)
File "/usr/local/lib/python2.7/dist-packages/numpy/core/numeric.py", line 531, in asarray
return array(a, dtype, copy=False, order=order)
MemoryError
我有8GB的内存。是否有可能为我的数据获取直方图?
在此先感谢!
您是否使用'plt.hist'而不是numpy? – DavidG
@DavidG不,一点都不习惯,我刚刚习惯了 – user2080209
这个错误仍然很奇怪,'plt.hist'确实调用'numpy.histogram',所以目前还不清楚为什么其中一个应该工作而不是另一个。 – ImportanceOfBeingErnest