Matplotlib Show Text Below Subplot

September 13, 2020
import math

col = 3
image_count = len(images)
row = math.ceil(image_count/col)
plt.figure(figsize=(col*4,row*4))

for i, img_path in enumerate(images):
    img_path = str(img_path)
    
    img = plt.imread(img_path)

    p = plt.subplot(row, col, i + 1)
    plt.imshow(img)

    # text above img
    plt.title("TOP TEXT")
    # text brlow img
    plt.text(0.5, -0.1, "BOTTOM TEXT",  transform=p.transAxes)
    
    plt.axis("off")

plt.show()
plt.close()
This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.