Hello, I think you could do the following
On Wednesday 13 January 2010 19:14:08 Someday... wrote: > Hello all, > > I am looking for a way to add points gradually to the plot over time. > Currently, in every iteration, I plot the entire array, like: > plt.ion() # turn on interactive mode (otherwise the window arises not before "show()") fig = plt.figure(); ax = fig.gca() xs = array([]) ys = array([]) # plot empty line to generate line object line, = ax.plot(xs,ys) while not done: // do some calculation.. // x=???, y=??? xs = append(xs,x); ys = append(ys,y); # reset line-data instead of new plotting line.set_data(xs, ys) plt.draw() plt.ioff() # turn off interactive mode In my experience this is better than plotting more and more versions of the same line or plotting one line for each '(x, y)'-data set ( I think this is due to the fact that each line-object holds information about its data, color, linetype, linewidth, marker, ...). Kind regards, Matthias > However, it seems like that the figure is re-drawn completely and so > significantly harms the performance. Rather, I want to add point each > iteration to the plot. > > fig = plt.figure(); > ax = fig.gca() > while not done: > // do some calculation.. > // x=???, y=??? > ax.AddPoint(x,y) > plt.draw() // or update()? > > I searched tutorials, but I couldn't find anything related yet. If anyone > knows how, please let me know. > > Thanks all, ------------------------------------------------------------------------------ Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies. http://p.sf.net/sfu/rsaconf-dev2dev _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users