|
From: Fernando P. <fpe...@gm...> - 2006-11-09 16:45:59
|
Hi Dan, On 11/9/06, Dan Karipides <ka...@tx...> wrote: > I did my best to search the examples, mailing list, etc. but was surprised > that I didn't even find this question asked, let alone answered. Coincidentally it was asked just yesterday by Andrea Gavana, but you may have missed it in your search (it may have crossed with your posting time). > My basic question: Is it possible to remove a data series from a matplotlib > plot? Here is a little self-contained example you can try (N==numpy, P=pylab): In [24]: x = N.arange(10) In [25]: fig = P.figure() In [26]: ax = fig.add_subplot(111) In [27]: ax.plot(x) Out[27]: [<matplotlib.lines.Line2D instance at 0x427ce7ec>] In [28]: ax.plot(x+10) Out[28]: [<matplotlib.lines.Line2D instance at 0x427ce88c>] In [29]: ax.plot(x+20) Out[29]: [<matplotlib.lines.Line2D instance at 0x427ce9ac>] In [30]: P.show() In [31]: ax.lines Out[31]: [<matplotlib.lines.Line2D instance at 0x427ce7ec>, <matplotlib.lines.Line2D instance at 0x427ce88c>, <matplotlib.lines.Line2D instance at 0x427ce9ac>] In [32]: del ax.lines[1] In [33]: P.show() This makes the middle line disappear from the plot. Regards, f |