plot() in a loop vs multiple curves with a single plot()

A B <python6009@...287...> 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

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]

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:


Jouni K. Sepp�nen