From: Fernando P. <fpe...@gm...> - 2006-11-09 22:41:41
|
On 11/9/06, John Hunter <jdh...@ac...> wrote: > >>>>> "Andrea" == Andrea Gavana <and...@gm...> writes: > > Andrea> Thank you guys, and thanks for the Wiki entry ;-) Andrea. > > Since ax.lines is just a list, you can also use the "remove" method > > line1, = ax.plot(something) > line2, = ax.plot(somethingelse) > line3, line4 = ax.plot(x3, y3, x4, y4) > > ax.lines.remove(line3) With the caveat that I think this is O(N) in the length of the list, with comparison operations at each step. I think 'del alist[i]' is also O(N), but amortized and with *much* smaller constant (only cheap internal pointer shuffling, without any real Python work). Someone with better knowledge of the list object internals, feel free to correct the above (I'm actually curious if the reality is different). Cheers, f |