我正在尝试在 python 中制作一个相当大的数据集的 hexbin 图。包含数据的两个数组有 3500 万个条目。但是,它们只占用 1.5 GB 的内存,而我有超过 4 GB 的可用内存。Hexbin 因内存错误而失败。
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
Traceback (most recent call last):
File "plotmodel.py", line 20, in <module>
plt.hexbin(d,t,m, bins='log', gridsize=20, xscale='log', lw=1, edgecolors='black', alpha=0.8, cmap=plt.cm.jet)
File "/Library/Frameworks/Python.framework/Versions/7.1/lib/python2.7/site-packages/matplotlib/pyplot.py", line 2142, in hexbin
ret = ax.hexbin(x, y, C, gridsize, bins, xscale, yscale, extent, cmap, norm, vmin, vmax, alpha, linewidths, edgecolors, reduce_C_function, mincnt, marginals, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/7.1/lib/python2.7/site-packages/matplotlib/axes.py", line 6035, in hexbin
iy2 = np.floor(y).astype(int)
MemoryError
hexbin 不能在大型数据集上工作或者是由于硬件限制导致的错误,有什么根本原因吗?