Assume I am running an interactive session, using
ipython -pylab
and have added a bunch of curves
x = linspace(0, 10, 100 )
plot( x, sin(x) )
plot( x, cos(x) )
and also added a text label
text( 1, 1, "Hello" )
But now I decide that I don't want the text anymore.
What's the best way to remove it from the graph?
(Because the graph is complicated I don't just want
to clf() and start all over - I just want to remove that
one element.)
What I have found is that if I save the object created,
I can invoke its remove() function:
t =text( 2, 1, "Hello again" )
t.remove()
draw()
Is this the best way to do this, or is there another way
(or one that does not require an explicit draw()?). Also,
what if I have failed to save the text instance - do I have
to walk the object tree using findobj()?
Thanks!
Best,
Ph.