Python puts out a memory error after drawing a few graphs with pyplot (I draw plots with over a million points on a laptop - and how many graphs can be drawn before the error has direct relationship with the amount of points).
How can the memory be cleared after, so that I can draw more graphs? The only option now is to ctrl + .
to restart the kernel.
I have tried the recommended:
matplotlib.pyplot.close("all")
matplotlib.pyplot.clf()
Doesn't clear the errors.
I've been battling this for weeks and the only thing that worked for me was the solution presented here:
How to clear memory completely of all Matplotlib plots
matplotlib.pyplot.figure().clear()
matplotlib.pyplot.close()
The following:
plt.cla()
and
plt.clf()
didn't work for me at all... I suspect because it was designed for when you have more than one subplot...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With