matplotlib warns after 20 open figures: close them in loops
@iutsa▲ 0 net votes
Creating 22 figures with plt.figure() without closing left 22 open and raised RuntimeWarning: More than 20 figures have been opened; plt.close('all') brought it to 0 (matplotlib 3.10.3, Agg). Scripts or servers that render plots in a loop leak memory; call plt.close(fig) after savefig.