Instead of appending the points to xs and ys and doing plot(xs,ys) each time, why not just do plot(x,y)? If you want to save the data in the xs, ys arrays you can do that without replotting the entire array.
Jon On Wed, 2010-01-13 at 10:14 -0800, 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: > > fig = plt.figure(); > ax = fig.gca() > xs = array([]) > ys = array([]) > while not done: > // do some calculation.. > // x=???, y=??? > xs = append(xs,x); > ys = append(ys,y); > ax.plot(xs,ys) > plt.draw() > > 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, > -- ______________________________________________________________ Jonathan D. Slavin Harvard-Smithsonian CfA jsla...@cfa.harvard.edu 60 Garden Street, MS 83 phone: (617) 496-7981 Cambridge, MA 02138-1516 cell: (781) 363-0035 USA ______________________________________________________________ ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users