Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Eric Firing <efiring@ha...>  20100206 17:09:53

David Arnold wrote: > All, > > I am still wondering why there is no comet command in matplotlib. > > I was successful with the following: > > import matplotlib.pyplot as plt > import numpy as np > > len=200 > t=np.linspace(0,2*np.pi,len) > x=np.cos(t) > y=np.sin(t) > xd=[x[0]] > yd=[y[0]] > l,=plt.plot(xd,yd) > plt.axis([1,1,1,1]) > > for i in np.arange(1,len): > xd.append(x[i]) > yd.append(y[i]) > l.set_xdata(xd) > l.set_ydata(yd) > plt.draw() > > plt.show() > > > But it seems that a comet function added to the matplotlib library would greatly simplify things for students using the interactive pylab in ipython. > I don't understandwhat's the point of the example? What is "comet", and how does it simplify anything? Eric 
From: David Arnold <dwarnold45@su...>  20080815 06:59:11

All, Does anyone have any code emulating Matlab's comet command? D. 
From: David Arnold <dwarnold45@su...>  20091207 16:00:40

All, Is there anything resembling Matlab's comet command? D. 
From: David Arnold <dwarnold45@su...>  20100206 07:11:31

All, I am still wondering why there is no comet command in matplotlib. I was successful with the following: import matplotlib.pyplot as plt import numpy as np len=200 t=np.linspace(0,2*np.pi,len) x=np.cos(t) y=np.sin(t) xd=[x[0]] yd=[y[0]] l,=plt.plot(xd,yd) plt.axis([1,1,1,1]) for i in np.arange(1,len): xd.append(x[i]) yd.append(y[i]) l.set_xdata(xd) l.set_ydata(yd) plt.draw() plt.show() But it seems that a comet function added to the matplotlib library would greatly simplify things for students using the interactive pylab in ipython. Any plans? David 
From: Eric Firing <efiring@ha...>  20100206 17:09:53

David Arnold wrote: > All, > > I am still wondering why there is no comet command in matplotlib. > > I was successful with the following: > > import matplotlib.pyplot as plt > import numpy as np > > len=200 > t=np.linspace(0,2*np.pi,len) > x=np.cos(t) > y=np.sin(t) > xd=[x[0]] > yd=[y[0]] > l,=plt.plot(xd,yd) > plt.axis([1,1,1,1]) > > for i in np.arange(1,len): > xd.append(x[i]) > yd.append(y[i]) > l.set_xdata(xd) > l.set_ydata(yd) > plt.draw() > > plt.show() > > > But it seems that a comet function added to the matplotlib library would greatly simplify things for students using the interactive pylab in ipython. > I don't understandwhat's the point of the example? What is "comet", and how does it simplify anything? Eric 
From: David Arnold <dwarnold45@su...>  20100206 18:21:22

Hi Eric, Matlab has two commands, comet and comet3, that animate the path. They are used as in the following Matlab code: t=linspace(0,2*pi,2000); x=sin(t); y=cos(t); comet(x,y) What then happens is the path is drawn "live", as in my python code below. This is especially useful when teaching parametric equations in calculus. A typical question in that section might be: "find a parametrization for the unit circle that starts at (0,1) and moves around the circle one time in the counterclockwise direction." In this situation, the following is not helpful: t=linspace(0,2*pi,2000); x=sin(t); y=cos(t); plot(x,y) Because the student just sees sees the "finished" path. The comet command, on the other hand, allows the student to "see" that path as it is traced out in real time. David. On Feb 6, 2010, at 9:09 AM, Eric Firing wrote: > David Arnold wrote: >> All, >> I am still wondering why there is no comet command in matplotlib. I was successful with the following: >> import matplotlib.pyplot as plt >> import numpy as np >> len=200 >> t=np.linspace(0,2*np.pi,len) >> x=np.cos(t) >> y=np.sin(t) >> xd=[x[0]] >> yd=[y[0]] >> l,=plt.plot(xd,yd) >> plt.axis([1,1,1,1]) >> for i in np.arange(1,len): >> xd.append(x[i]) >> yd.append(y[i]) >> l.set_xdata(xd) >> l.set_ydata(yd) >> plt.draw() >> >> plt.show() >> But it seems that a comet function added to the matplotlib library would greatly simplify things for students using the interactive pylab in ipython. > > I don't understandwhat's the point of the example? What is "comet", and how does it simplify anything? > > Eric > 
From: Goyo <goyodiaz@gm...>  20100206 21:38:33

Hi David, El sáb, 06022010 a las 10:21 0800, David Arnold escribió: > Hi Eric, > > Matlab has two commands, comet and comet3, that animate the path. They are used as in the following Matlab code: > > t=linspace(0,2*pi,2000); > x=sin(t); > y=cos(t); > comet(x,y) You can just write the function: import matplotlib.pyplot as plt def comet(x, y, fmt='', step=1, **kwargs): l, = plt.plot(x, y, fmt, **kwargs) num_points = len(x) for i in xrange(1, num_points + 1, step): l.set_data(x[:i], y[:i]) plt.draw() l.set_data(x, y) plt.draw() I think this could be better done using animation features of matplotlib, but I never used them and I think they varies across toolkits. Search the docs for animation examples anyway. Goyo > > What then happens is the path is drawn "live", as in my python code below. > > This is especially useful when teaching parametric equations in calculus. A typical question in that section might be: "find a parametrization for the unit circle that starts at (0,1) and moves around the circle one time in the counterclockwise direction." In this situation, the following is not helpful: > > t=linspace(0,2*pi,2000); > x=sin(t); > y=cos(t); > plot(x,y) > > Because the student just sees sees the "finished" path. The comet command, on the other hand, allows the student to "see" that path as it is traced out in real time. > > David. > > On Feb 6, 2010, at 9:09 AM, Eric Firing wrote: > > > David Arnold wrote: > >> All, > >> I am still wondering why there is no comet command in matplotlib. I was successful with the following: > >> import matplotlib.pyplot as plt > >> import numpy as np > >> len=200 > >> t=np.linspace(0,2*np.pi,len) > >> x=np.cos(t) > >> y=np.sin(t) > >> xd=[x[0]] > >> yd=[y[0]] > >> l,=plt.plot(xd,yd) > >> plt.axis([1,1,1,1]) > >> for i in np.arange(1,len): > >> xd.append(x[i]) > >> yd.append(y[i]) > >> l.set_xdata(xd) > >> l.set_ydata(yd) > >> plt.draw() > >> > >> plt.show() > >> But it seems that a comet function added to the matplotlib library would greatly simplify things for students using the interactive pylab in ipython. > > > > I don't understandwhat's the point of the example? What is "comet", and how does it simplify anything? > > > > Eric > > > > >  > The Planet: dedicated and managed hosting, cloud storage, colocation > Stay online with enterprise data centers and the best network in the business > Choose flexible plans and management services without longterm contracts > Personal 24x7 support from experience hosting pros just a phone call away. > http://p.sf.net/sfu/theplanetcom > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers 
From: David Arnold <dwarnold45@su...>  20100206 22:46:42

Goyo, Sweet little function. Thanks. I still feel that a comet routine should be added to matplotlib for the reasons I've delineated. D. On Feb 6, 2010, at 1:38 PM, Goyo wrote: > Hi David, > > El sáb, 06022010 a las 10:21 0800, David Arnold escribió: >> Hi Eric, >> >> Matlab has two commands, comet and comet3, that animate the path. They are used as in the following Matlab code: >> >> t=linspace(0,2*pi,2000); >> x=sin(t); >> y=cos(t); >> comet(x,y) > > You can just write the function: > > import matplotlib.pyplot as plt > > def comet(x, y, fmt='', step=1, **kwargs): > l, = plt.plot(x, y, fmt, **kwargs) > num_points = len(x) > for i in xrange(1, num_points + 1, step): > l.set_data(x[:i], y[:i]) > plt.draw() > l.set_data(x, y) > plt.draw() > > I think this could be better done using animation features of > matplotlib, but I never used them and I think they varies across > toolkits. Search the docs for animation examples anyway. > > Goyo > >> >> What then happens is the path is drawn "live", as in my python code below. >> >> This is especially useful when teaching parametric equations in calculus. A typical question in that section might be: "find a parametrization for the unit circle that starts at (0,1) and moves around the circle one time in the counterclockwise direction." In this situation, the following is not helpful: >> >> t=linspace(0,2*pi,2000); >> x=sin(t); >> y=cos(t); >> plot(x,y) >> >> Because the student just sees sees the "finished" path. The comet command, on the other hand, allows the student to "see" that path as it is traced out in real time. >> >> David. >> >> On Feb 6, 2010, at 9:09 AM, Eric Firing wrote: >> >>> David Arnold wrote: >>>> All, >>>> I am still wondering why there is no comet command in matplotlib. I was successful with the following: >>>> import matplotlib.pyplot as plt >>>> import numpy as np >>>> len=200 >>>> t=np.linspace(0,2*np.pi,len) >>>> x=np.cos(t) >>>> y=np.sin(t) >>>> xd=[x[0]] >>>> yd=[y[0]] >>>> l,=plt.plot(xd,yd) >>>> plt.axis([1,1,1,1]) >>>> for i in np.arange(1,len): >>>> xd.append(x[i]) >>>> yd.append(y[i]) >>>> l.set_xdata(xd) >>>> l.set_ydata(yd) >>>> plt.draw() >>>> >>>> plt.show() >>>> But it seems that a comet function added to the matplotlib library would greatly simplify things for students using the interactive pylab in ipython. >>> >>> I don't understandwhat's the point of the example? What is "comet", and how does it simplify anything? >>> >>> Eric >>> >> >> >>  >> The Planet: dedicated and managed hosting, cloud storage, colocation >> Stay online with enterprise data centers and the best network in the business >> Choose flexible plans and management services without longterm contracts >> Personal 24x7 support from experience hosting pros just a phone call away. >> http://p.sf.net/sfu/theplanetcom >> _______________________________________________ >> Matplotlibusers mailing list >> Matplotlibusers@... >> https://lists.sourceforge.net/lists/listinfo/matplotlibusers > > > >  > The Planet: dedicated and managed hosting, cloud storage, colocation > Stay online with enterprise data centers and the best network in the business > Choose flexible plans and management services without longterm contracts > Personal 24x7 support from experience hosting pros just a phone call away. > http://p.sf.net/sfu/theplanetcom > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers 
Sign up for the SourceForge newsletter:
No, thanks