I have a matplotlib window with multiple subplots in it. I want to be able to dynamically update the contents of each subplot whenever a method is called. The simplified code looks like this:
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure(1)
fig, ax_list = plt.subplots(3, 2)
image1 = plt.imread("image1.jpg")
image2 = plt.imread("image2.jpg")
ax_list = ax_list.ravel()
ax_list[0].imshow(image1)
ax_list[1].imshow(image2)
plt.show()
def update_subplots():
# I want this method to change the contents of the subplots whenever it is called
pass