尝试将超大数组(~5000000200)保存为映像,但matplotlib会引发ValueError: Image size of 4741988x210 pixels is too large. It must be less than 2^16 in each direction
代码如下:
from matplotlib.ticker import FixedLocator, FixedFormatter
fig = plt.figure(figsize = (4741988,210), frameon=False, dpi = 1)
ax = fig.gca()
ax.imshow(final_image_train)
y_formatter = FixedFormatter(np.arange(start_len_train,end_len_train+1,1))
y_locator = FixedLocator(np.linspace(0, final_image_train.shape[0], end_len_train - start_len_train))
ax.yaxis.set_major_formatter(y_formatter)
ax.yaxis.set_major_locator(y_locator)
ax.tick_params(axis="y", labelsize=1, length = 2, width = 0.1, grid_linewidth = 0.01, pad = 0.1)
plt.xticks([])
ax.patch.set_visible(False)
plt.box(on=None)
plt.savefig('test.svg', bbox_inches='tight', pad_inches = 0)
所以我想知道有没有办法以高质量保存这样的图像?为什么mpl将最大大小限制为2^16。我的机器配备32gb内存。 除了matplotlib,我们还有其他软件包来处理如此大的阵列吗? 如有任何建议,将不胜感激
目前没有回答
相关问题 更多 >
编程相关推荐