On Fri, Mar 26, 2010 at 06:08:54PM -0500, Mike Miller wrote:
> >> Is it hard to learn to make graphs in Matplotlib starting from, say, a 
> >> tab-delimited data file?
> >
> > Not at all:
> > 
> > http://matplotlib.sourceforge.net/examples/pylab_examples/scatter_demo.html
> 
> That doesn't seem to import a data file, but I'll take your word for it. 
> That code is very simple (in the good sense of the word).

For that, you use the python built-in csv module:

---8<---8<---8<---8<---8<---8<---8<---8<

   import csv

   x = []
   y = []

   dataReader = csv.reader(open('my.csv'), delimiter=',',  quotechar='"')

   # load the first row, as it contains the column names
   header = dataReader.next()

   # read row-wise and append to columns
   for row in spamReader:
      x.append(row[0])
      y.append(row[1])
   dataReader.close()

---8<---8<---8<---8<---8<---8<---8<---8<

Then plot(x, y) should do the trick.

Cheers,
florin

-- 
Bruce Schneier expects the Spanish Inquisition.
      http://geekz.co.uk/schneierfacts/fact/163
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mailman.mn-linux.org/pipermail/tclug-list/attachments/20100326/58847542/attachment.pgp