Re: [Matplotlib-users] Removing a data series

2006-11-09 Thread Fernando Perez
Hi Dan,

On 11/9/06, Dan Karipides [EMAIL PROTECTED] 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

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Removing a data series

2006-11-09 Thread Angus McMorland
On 10/11/06, Dan Karipides [EMAIL PROTECTED] wrote:
 Fernando,

 Thanks, this is exactly what I need.

 BTW, I think I missed it in the search because the archive here:

 http://sourceforge.net/mailarchive/forum.php?forum_id=33405

 doesn't show anything more recent that 10/02/2006.  I'm not sure why this
 is.

 Thanks again,

 -Dan
 -
 [EMAIL PROTECTED]


Since this is the third time I've seen this question pop up in a  few
months, I've put an entry in the wiki for it here
(http://www.scipy.org/Cookbook/Matplotlib/DeletingAnExistingDataSeries).
Fernando, I hope you don't mind me using your example on the page - it
seemed the most thorough.

A.
-- 
AJC McMorland, PhD Student
Physiology, University of Auckland

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users