Given a list of images each with size (H, W) and given plot with (n_rows, n_cols). Is there a formula for calculating the right figure size? For example, for the following code below:
images = [np.random.rand(20, 22) for i in range(32)]
fig = plt.figure(figsize=(6, 14))
axes = [fig.add_subplot(9,3,i+1) for i in range(9)]
for c, ax in enumerate(axes):
ax.set_xticklabels([])
ax.set_yticklabels([])
ax.imshow(images[c])
fig.subplots_adjust(wspace=0, hspace=0)
I want to remove the gaps between images. So manually, I found that figsize=(6, 17) yields what I want: