Any idea how to do this?


During iteration, before making a new line

check if x and y coordinates of the new line are the same as any of the lines already contained in the plot's Axes..
So, I would like to know if there is a way to delete an line already plotted using matplotlib. But here is the thing:
I'm plotting within a for loop, and I would like to check before plotting if the line that I'm about to draw is already on the figure, and if so, I would like to delete it.
I was told an idea about plotting it anyways but with the same color of the background, but again, to do this I would have to check if the line already exists. Any idea how to do this?
Checking if a line was already drawn in matplotlib and deleting it