I think I'm erasing the gaps with wspace and hspace, but the image after execution has an unnatural gap
defketugou (path, outpath, zyunban, tate, yoko):
d = [ ]
for i in range (tate*yoko):
img=Image.open(path+"/chunk_"+str(int(zyunban[i]))+".png")
img=np.asarray(img)
d.append(img)
config,ax=plt.subplots(tate,yoko,figsize=(10,10)))
config.subplots_adjust (wspace=0, hspace=0)
for i in range(tate):
for jin range (yoko):
ax[i,j].xaxis.set_major_locator(plt.NullLocator())
ax[i,j].yaxis.set_major_locator(plt.NullLocator())
ax[i,j].imshow(d[yoko*i+j],cmap="bone")
plt.savefig(outputpath, format=os.path.splitext(outputpath)[1][1:], dpi=360)
print('finished')
You may be able to resolve this by adding aspect="auto"
to the argument imshow
.
According to the link above, aspect="equal"
is drawn to guarantee an aspect ratio of 1.
This may create a 1-pixel gap when drawing.
© 2024 OneMinuteCode. All rights reserved.