我有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