A B <python6...@gmail.com> writes: > I have the following code and am wondering whether there is a more > efficient way to plot multiple curves. Maybe somehow accumulating the > data into a single variable, then calling plot once ... Thanks for any > ideas. > > for ofile in files: > d = mlab.csv2rec(ofile, names = ['date','field']) > ax.plot(d['date'], d['field'])
You can give multiple x,y pairs to plot, so perhaps something like data = [mlab.csv2rec(f, names=['date','field']) for f in files] data = [[x['date'],x['field']] for x in data] ax.plot(*np.concatenate(data)) would work. But I don't know if it's really any more efficient. For large plots, you may want to take a look at collections: http://matplotlib.sourceforge.net/api/collections_api.html#matplotlib.collections.LineCollection -- Jouni K. Seppänen http://www.iki.fi/jks ------------------------------------------------------------------------------ This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users