I don't understand why this is so hard, but I can't figure out how to do it. If I have multiple lines or points plotted and want to clear one of them, how is that done? Other posts point to remove(), but this is not working in my case. See example:
Python 2.7.5 (default, Apr 2 2020, 13:16:51)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>>
>>> plt.ion()
>>> x = np.arange(100.) / 99
>>> y = np.sin(x)
>>> fig, ax = plt.subplots()
>>> h = ax.plot(x, y)
>>> h.remove()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: remove() takes exactly one argument (0 given)
h, = ax.plot(x, y)asplot()returns a list (containing one element). See matplotlib 2d line line,=plot comma meaning