@@ -6,32 +6,37 @@ from bashplotlib.utils.helpers import *
66from bashplotlib .histogram import plot_hist
77
88
9- if __name__ == ' __main__' :
9+ if __name__ == " __main__" :
1010
1111 parser = optparse .OptionParser (usage = hist ['usage' ])
1212
1313 parser .add_option ('-f' , '--file' , help = 'a file containing a column of numbers' ,
1414 default = None , dest = 'f' )
1515 parser .add_option ('-t' , '--title' , help = 'title for the chart' ,
16- default = '' , dest = 't' )
16+ default = "" , dest = 't' )
1717 parser .add_option ('-b' , '--bins' , help = 'number of bins in the histogram' ,
1818 type = 'int' , default = None , dest = 'b' )
1919 parser .add_option ('-s' , '--height' , help = 'height of the histogram (in lines)' ,
2020 type = 'int' , default = 20. , dest = 'h' )
2121 parser .add_option ('-p' , '--pch' , help = 'shape of each bar' , default = 'o' , dest = 'p' )
22- parser .add_option ('-x' , '--xlab' , help = 'label bins on x-axis' , default = None , action = ' store_true' , dest = 'x' )
23- parser .add_option ('-c' , '--colour' , help = 'colour of the plot (%s)' % ', ' .join ([c for c in bcolours .keys () if c != 'ENDC' ]),
22+ parser .add_option ('-x' , '--xlab' , help = 'label bins on x-axis' , default = None , action = " store_true" , dest = 'x' )
23+ parser .add_option ('-c' , '--colour' , help = 'colour of the plot (%s)' % ", " .join ([c for c in bcolours .keys () if c != 'ENDC' ]),
2424 default = 'white' , dest = 'colour' )
25+ parser .add_option ('-d' , '--demo' , help = 'run demos' , action = 'store_true' , dest = 'demo' )
26+ parser .add_option ('-n' , '--nosummary' , help = 'run demos' , action = 'store_true' , dest = 'nosummary' )
2527
2628 (opts , args ) = parser .parse_args ()
2729
2830 if opts .f is None :
2931 if len (args ) > 0 :
3032 opts .f = args [0 ]
31- else :
33+ elif opts . demo is False :
3234 opts .f = sys .stdin .readlines ()
3335
34- if opts .f :
35- plot_hist (opts .f , opts .h , opts .b , opts .p , opts .colour , opts .t , opts .x )
36+ if opts .demo :
37+ run_demo ()
38+ elif opts .f :
39+ plot_hist (opts .f , opts .h , opts .b , opts .p , opts .colour , opts .t , opts .x , opts .nosummary )
3640 else :
3741 print "nothing to plot!"
42+
0 commit comments