#!/usr/bin/env python

## Plots csv x-y csv files using pyplot; tolerates comment lines.

import csv
import matplotlib.pyplot as pyplot
import sys

if len(sys.argv) < 2:
    sys.exit('Usage: plot <filename> ...')

for filename in sys.argv[1:]:
    with open(filename) as f:
        reader = csv.reader(filter(lambda row: row[0]!='#', f), delimiter=',')
        table = [(float(row[0]), float(row[1])) for row in reader]
        pyplot.plot([row[0] for row in table], [row[1] for row in table])
pyplot.show()
