I have data analysis module that contains functions which call on Matplotlib pyplot API multiple times to generate up to 30 figures in each run. These figures get immediatel
I have data analysis module that contains functions which call on Matplotlib pyplot API multiple
Can you edit your functions which is calling matplotlib? I was facing the same issue, I tried following command but none of it worked.
plt.close(fig)
fig.clf()
gc.collect()
%reset_selective -f fig
Then one trick worked for me, instead of creating a new figure every time, I pass the same fig object to the function and this solved my issue.
for example use,
fig = plt.figure()
for i in range(100):
plt.plot(x,y)
instead of,
for i in range(100):
fig = plt.figure()
plt.plot(x,y)