Python matplotlib-尝试绘制网格时出现分段错误(堆芯转储)

Python matplotlib-尝试绘制网格时出现分段错误(堆芯转储),python,python-3.x,linux,matplotlib,pytorch,Python,Python 3.x,Linux,Matplotlib,Pytorch,我正在尝试绘制网格,但存在错误消息- (feature_vis.py:27730): Gdk-WARNING **: 03:23:47.745: Native Windows wider or taller than 32767 pixels are not supported Segmentation fault (core dumped) model_weights='./互信道损耗主机/model_info_best.pth' 型号\功能='/互信道损耗主/功能\最佳\新.pth' 重量

我正在尝试绘制网格,但存在错误消息-

(feature_vis.py:27730): Gdk-WARNING **: 03:23:47.745: Native Windows wider or taller than 32767 pixels are not supported
Segmentation fault (core dumped)
model_weights='./互信道损耗主机/model_info_best.pth'
型号\功能='/互信道损耗主/功能\最佳\新.pth'
重量=火炬.负载(型号重量,地图位置=火炬.设备('cpu'))
features=torch.load(型号\功能,地图\位置=torch.device('cpu'))
激活=功能['features']
功能图=激活[0][0][3]
#特征映射=np.load(路径,允许pickle=True)
#测试=要素地图[0][0][0]
图=plt.图(figsize=(300500))
网格=图像网格(图111,类似于子地块(111)
nrows_ncols=(20,30),#创建2x2轴网格
轴#pad=0.1,轴之间的#pad以英寸为单位。
)
对于ax,im在zip中(网格、功能图):
#在网格上迭代将返回轴。
im=im.to('cpu').numpy()
ax.imshow(im,cmap='gray')
plt.savefig('test.png',ppi=300)
我应该如何修复/调试此问题


我使用的是python 3.6.9,在ubuntu 18.04上,属性figsize使用的单位是英寸。因此,一幅300x500大小、dpi=300的图像非常巨大(4500万像素),而
mpl
无法处理。如果你想要一张300×500(像素)的图像,你必须先把它转换成英寸。在这种情况下,它可能类似于~1x1.7。

为什么我在windows中没有遇到这个问题?windows会自动调整大小吗?我不知道