## matplotlib-users

 [Matplotlib-users] plot a moving point from an input file From: hussein alshatri - 2008-07-20 19:31:49 ```Hi all, I am new with matplotlib. I want to use matplotlib/animation. I want to plot a moving point. The information comes from input file that include columens as bellow: #time x_coordinate y_coordinate I have seen the examples on the website, But I don't know how to configure the time. Could anyone just guide me how to do this or if there is a short example it would be great... Thank you in advanced. Hussein _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ ```
 Re: [Matplotlib-users] plot a moving point from an input file From: charlesrkiss - 2008-07-20 20:11:00 ```I would like to know how to plot a stationary point. Do you know how to plot a stationary point?? I will also be interested in plotting a moving point; so I'll be interested in this post. < I want to plot a moving point. The information comes from input file that include columens as bellow: #time x_coordinate y_coordinate -- View this message in context: http://www.nabble.com/plot-a-moving-point-from-an-input-file-tp18557820p18558156.html Sent from the matplotlib - users mailing list archive at Nabble.com. ```
 Re: [Matplotlib-users] plot a moving point from an input file From: charlesrkiss - 2008-07-21 06:25:18 ``` How about this for a stationary point: from pylab import * def point(x,y): a=arange(x,x+1,1) b=arange(y,y+1,1) plot(a,b, 'ro', ms=3) show() This works for me. Load the module "point" Run it by typing point(x,y), where x and y are the coordinates you'd like to see in a plot, and a magical red "point" will appear in your matplotlib figure. You can change the color and size, of course, by modifying the color ('ro') and markersize ('ms= 3') keyword arguments to suit your needs. Now just put in a t parameter, I guess. hussein alshatri wrote: > > > Hi all, > > I am new with matplotlib. I want to use matplotlib/animation. > > I want to plot a moving point. The information comes from input file that > include columens as bellow: > > #time x_coordinate y_coordinate > > I have seen the examples on the website, But I don't know how to configure > the time. > > Could anyone just guide me how to do this or if there is a short example > it would be great... > > Thank you in advanced. > > Hussein > _________________________________________________________________ > Express yourself instantly with MSN Messenger! Download today it's FREE! > http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win great > prizes > Grand prize is a trip for two to an Open Source event anywhere in the > world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://www.nabble.com/plot-a-moving-point-from-an-input-file-tp18557820p18562838.html Sent from the matplotlib - users mailing list archive at Nabble.com. ```
 Re: [Matplotlib-users] plot a moving point from an input file From: Matthias Michler - 2008-07-21 07:57:31 ```Hello Hussein, maybe the following example helps you. It uses the module 'time' to wait for some seconds. regards Matthias --------------- "test.dat": ---------------------------------------------- #time x_coordinate y_coordinate 0.1 1 1 0.2 2 2 0.3 3 3 0.4 4 4 -------------------- "... .py": -------------------------------------------------- from scipy.io import read_array import pylab as pl import numpy as npy import time data = read_array("test.dat") pl.ion() # Turn interactive mode on. pl.figure() pl.subplot(111, autoscale_on=False) pl.axis([0.0, 5.0, 0.0, 5.0]) # plot the first point: point, = pl.plot([data[0, 1]], [data[0, 2]], 'b+') pl.draw() print "first (x, y) = ", data[0, 1:] for i in xrange(1, npy.shape(data)[0]): # wait time-difference * 10 seconds time.sleep((data[i, 0]-data[i-1, 0])*10) # reset data of plotted point point.set_data(npy.array([data[i, 1]]), npy.array([data[i, 2]])) pl.draw() pl.draw() print "new (x, y) = ", data[i, 1:] pl.ioff() # Turn interactive mode off. pl.show() ------------------------------------------------------------------------------------------- On Sunday 20 July 2008 21:31:42 hussein alshatri wrote: > Hi all, > > I am new with matplotlib. I want to use matplotlib/animation. > > I want to plot a moving point. The information comes from input file that > include columens as bellow: > > #time x_coordinate y_coordinate > > I have seen the examples on the website, But I don't know how to configure > the time. > > Could anyone just guide me how to do this or if there is a short example it > would be great... > > Thank you in advanced. > > Hussein ```
 Re: [Matplotlib-users] plot a moving point from an input file From: John Hunter - 2008-07-21 10:35:51 ```On Mon, Jul 21, 2008 at 2:57 AM, Matthias Michler wrote: > Hello Hussein, > > maybe the following example helps you. It uses the module 'time' to wait for > some seconds. A note of caution: this example will probably only work with tkagg. For other GUIs, like gtk, wx, or qt, you will probably want to use a timeout handler. JDH ```