Skip to content

Instantly share code, notes, and snippets.

@sordina
Created December 1, 2015 09:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sordina/5de735198c3250538075 to your computer and use it in GitHub Desktop.
Save sordina/5de735198c3250538075 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import matplotlib as plt
import pandas as pd
import sys
import os
outname = "/tmp/plot-columns-{}.png".format(os.getpid())
infile = None
if len(sys.argv) > 1:
infile = sys.argv[1]
else:
infile = sys.stdin
# TODO: This only allows for up to 2 columns...
d = pd.read_csv(infile, header=None)
p = d.plot(linewidth=3,secondary_y=d.columns.values[1:], figsize=(25,8))
f = p.get_figure()
f.savefig(outname)
print outname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment