line set_visible() and legend

Hi gang,

    I apologize to come up always with noob questions, but it's been a
while I used matplotlib seriously...
Related to the "deleting a line from a plot" subject, I was thinking
about *hiding* the line instead of completely erasing it from the
graph. This is because the user can check or unchech a checkbox that
toggles the line visibility, and it would be much easier to call
set_visible() instead of continuously deleting/replotting the line.
Now, how does this impact on legend? I mean, is there a way with which
I can simply hide a line => update the legend by removing the missing
line label, or show a line => restore the legend label?

Thank you for every pointer.



"Imagination Is The Only Weapon In The War Against Reality."