I am using the following code to plot an image in matplotlib:
import matplotlib.pyplot as plt
from pylab import Axes
fig, axes = plt.subplots(nrows=2, ncols=2, figsize=(16,12))
ax = Axes(plt.gcf(),[0,0,1,1],yticks=[],xticks=[],frame_on=False)
plt.gcf().delaxes(plt.gca())
plt.gcf().add_axes(ax)
image = plt.imread("../plots/background.jpg")
ax.imshow(image, zorder=2, extent=[0, 100, 0, 100])
for i, ax in enumerate(fig.get_axes()):
ax.text(0.5, 0.5, f"Subplot {i}", color="black", size=20, zorder=3)
I want to have the image as the background for the whole figure and print text in each subplots? What changes should I make in my code?