I'm trying to plot three images with their subtitles above them but nothing is showing right now.
import cv2
from matplotlib import pyplot as plt
img = cv2.imread('kids.tif')
# Averaged environment
avg_blur = cv2.blur(img,(5,5))
# Gaussian filter
gauss_blur = cv2.GaussianBlur(img,(0,0),5)
# Median filter
median_blur = cv2.medianBlur(img,5)
f, axarr = plt.subplots(nrows=1,ncols=3)
axarr[0].imshow(img)
axarr[1].imshow(avg_blur)
axarr[2].imshow(gauss_blur)
"""
plt.subplot(121),plt.imshow(img),plt.title('Original')
plt.xticks([]), plt.yticks([])
plt.subplot(122),plt.imshow(avg_blur),plt.title('Averaged environment')
plt.xticks([]), plt.yticks([])
plt.show()
"""
Solution
Output:

Code Similar to Your Implementation
It is easier to just set the current axis
plt.sca(ax)and then plot as if you have just one subplot to deal with. This makes your code easy to modify and if need be, swiftly move into a loop.References