#subplot(r,c) provide the no. of rows and columns
f, axarr = plt.subplots(2,1)
# use the created array to output your multiple images. In this case I have stacked 2 images vertically
axarr[0].imshow(img1)
axarr[1].imshow(np.log(img2))
plt.show()
import numpy as np
import matplotlib.pyplot as plt
w = 10
h = 10
fig = plt.figure(figsize=(8, 8))
columns = 4
rows = 5
for i in range(1, columns*rows +1):
img = np.random.randint(10, size=(h,w))
fig.add_subplot(rows, columns, i)
plt.imshow(img)
plt.show()