How can I remove a line (or lines) of a matplotlib axes in such a way as it actually gets garbage collected and releases the memory back? The below code appears to delete t
I've tried lots of different answers in different forums. I guess it depends on the machine your developing. But I haved used the statement
ax.lines = []
and works perfectly. I don't use cla() cause it deletes all the definitions I've made to the plot
Ex.
pylab.setp(_self.ax.get_yticklabels(), fontsize=8)
but I've tried deleting the lines many times. Also using the weakref library to check the reference to that line while I was deleting but nothing worked for me.
Hope this works for someone else =D