MCPcopy Index your code
hub / github.com/glamp/bashplotlib / main

Function main

bashplotlib/histogram.py:218–257  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

216
217
218def main():
219
220 parser = optparse.OptionParser(usage=hist['usage'])
221
222 parser.add_option(
223 '-f', '--file', help='a file containing a column of numbers', default=None, dest='f')
224 parser.add_option('-t', '--title', help='title for the chart', default="", dest='t')
225 parser.add_option(
226 '-b', '--bins', help='number of bins in the histogram', type='int', default=None, dest='b')
227 parser.add_option('-w', '--binwidth', help='width of bins in the histogram',
228 type='float', default=None, dest='binwidth')
229 parser.add_option('-s', '--height', help='height of the histogram (in lines)',
230 type='int', default=None, dest='h')
231 parser.add_option('-p', '--pch', help='shape of each bar', default='o', dest='p')
232 parser.add_option('-x', '--xlab', help='label bins on x-axis',
233 default=None, action="store_true", dest='x')
234 parser.add_option('-c', '--colour', help='colour of the plot (%s)' %
235 colour_help, default='default', dest='colour')
236 parser.add_option('-d', '--demo', help='run demos', action='store_true', dest='demo')
237 parser.add_option('-n', '--nosummary', help='hide summary',
238 action='store_false', dest='showSummary', default=True)
239 parser.add_option('-r', '--regular',
240 help='use regular y-scale (0 - maximum y value), instead of truncated y-scale (minimum y-value - maximum y-value)',
241 default=False, action="store_true", dest='regular')
242
243 opts, args = parser.parse_args()
244
245 if opts.f is None:
246 if len(args) > 0:
247 opts.f = args[0]
248 elif opts.demo is None or opts.demo is False:
249 opts.f = sys.stdin.readlines()
250
251 if opts.demo:
252 run_demo()
253 elif opts.f:
254 plot_hist(opts.f, opts.h, opts.b, opts.binwidth, opts.p, opts.colour,
255 opts.t, opts.x, opts.showSummary, opts.regular)
256 else:
257 print("nothing to plot!")
258
259
260if __name__ == "__main__":

Callers 1

histogram.pyFile · 0.70

Calls 2

run_demoFunction · 0.85
plot_histFunction · 0.85

Tested by

no test coverage detected