As a slightly different answer, remember that you can reuse numbers. Sort of:
fig = plt.figure() ax = plt.gca() im = ax.imshow(data_list[0],...) for new_data in data_list: im.set_cdata(new_data) fig.savefig(..)
This will lead to the fact that your code will work much faster, since it will not need to set and reset the digit more than 700 times.
source share