line collections - how to update

Hi All,

I am using the function vlines() to create a number of lines at sampling points below my sinewave (top right graph)
ie.
tt = axUpper2.vlines(t[xi],result[0], result[xi] )

were t is the time along x axis, and xi is the sample points and 'result' is the sine

This returns a "matplotlib.collections.LineCollection"
print tt
<matplotlib.collections.LineCollection instance at 0x01FA9E68>

I also have a slider for changing some input parameters, which will affect both amplitude and offset of 'result', .. however once things change I cannot work out how to change the data in my line collection. I need to get rid of the old lines, and create a new set or update the values in the current lines based on the new "result".

It's not obvious to me how I should go about it.
my first instinct was to try and iterate on the linecollection
    for l in tt:
        l.set_ydata(result[xi])

"TypeError: iteration over non-sequence"
I found out a collection is not iterable

I can call vlines() on each change, ..but I still don't know how to get rid of the old lines.

Can someone give me a pointer to functions I should look into, or make suggestion how to work this another way?.

Thanks
Steve

mod.png