I am trying to save each figure in a for loop in a folder. However for 4-5 runs of the loop only the last figure is saved. Why is it so? What modifications do I need to make?
for t in (0,l[k-1]):
plt.figure()
t=resized_right[0:resized_right.shape[0]-1, g+2:g+s+1]
plt.imshow(resized_right[0:resized_right.shape[0]-1, g+2:g+s+1])
plt.savefig(dir)
g+=s-2
p+=1
plt.show()
where dir is the directory where the image is to be stored.