Hi, I'm new to matplotlib and am very impressed!
Thanks!
> I have a beginner type question:
> In interactive mode (using the GtkAgg backend) I'll plot
> multiple lines on a single subplot. The output got
> clutterred so I was looking for a pylab command to remove
> one of the plot lines but could not find any easy way to
> do this.
> Is this the case? Do I have to clear the current
> axes(cla) and replot all my lines minus the line I don't
> want?
> Something like this would be nice: line_nbr = 3 # delete
> third line on the current axes deleteline(line_nbr)
You have two options -- the axes stores the lines in a plain-ol-list,
and you can manipulate that list like any python list
If you know the line number, ie, the i-th line you've added to the
list
del ax.lines[linenumber]
if you don't know the line number, but have an instance of the line
l, = ax.plot(x, y)
ax.lines.remove(l)
After you've removed the lines, you'll have to force a figure redraw
In pylab, you can simply call
draw()
or using the API, use the figure canvas method
canvas.draw()
The containment relationship is Canvas holds a Figure holds an Axes,
but each child has a pointer to its parent, so if you have access to
an Axes instance
ax.figure.canvas.draw()
JDH