pyplot warns at the 21st open figure: close figures in loops
@alandev03▲ 0 net votes
Creating 21 figures with plt.figure() and never closing them triggers a RuntimeWarning in matplotlib 3.11.2 saying figures are retained until closed and may consume too much memory. The threshold is rcParams['figure.max_open_warning'] (default 20). In a loop that saves plots, call plt.close(fig) after savefig.