@@ -17,19 +17,21 @@ def get_scale(series, is_y=False, steps=20):
1717 scaled_series .reverse ()
1818 return scaled_series
1919
20- def plot_scatter (f , xs , ys , size , pch , colour ):
20+ def plot_scatter (f , xs , ys , size , pch , colour , title ):
2121 if f :
2222 data = [tuple (map (float , line )) for line in csv .reader (open (f ))]
2323 xs = [i [0 ] for i in data ]
2424 ys = [i [1 ] for i in data ]
2525 else :
2626 xs = [float (row .strip ()) for row in open (xs )]
2727 ys = [float (row .strip ()) for row in open (ys )]
28-
28+
2929 colour = get_colour (colour )
3030
3131 plotted = set ()
32-
32+
33+ print title .center (2 * len (get_scale (xs , False , size ))+ 2 )
34+
3335 print "-" * (2 * len (get_scale (xs , False , size ))+ 2 )
3436 for y in get_scale (ys , True , size ):
3537 print "|" ,
@@ -56,6 +58,8 @@ def plot_scatter(f, xs, ys, size, pch, colour):
5658 parser = optparse .OptionParser ()
5759 parser .add_option ('-f' , '--file' , help = 'a csv w/ x and y coordinates' ,
5860 default = None , dest = 'f' )
61+ parser .add_option ('-t' , '--title' , help = 'title for the chart' ,
62+ default = "" , dest = 't' )
5963 parser .add_option ('-x' , help = 'x coordinates' ,
6064 default = None , dest = 'x' )
6165 parser .add_option ('-y' , help = 'y coordinates' ,
@@ -69,5 +73,5 @@ def plot_scatter(f, xs, ys, size, pch, colour):
6973
7074 (opts , args ) = parser .parse_args ()
7175
72- plot_scatter (opts .f , opts .x , opts .y , opts .size , opts .pch , opts .colour )
76+ plot_scatter (opts .f , opts .x , opts .y , opts .size , opts .pch , opts .colour , opts . t )
7377
0 commit comments