I am trying to overlay a matplotlib plot on an image using the following code snippet.
plt.imshow(image, zorder=0)
plt.plot(some_array, zorder=1)
plt.savefig('image_array.png')
If I now include this code inside a for loop to overlay a plot on a different image in each loop, the resulting images overlap. For example, image_array2.png sits on top of image_array1.png and so on. How do I correctly save the figures without overlapping?