forked from glamp/bashplotlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhist
More file actions
executable file
·39 lines (31 loc) · 1.58 KB
/
hist
File metadata and controls
executable file
·39 lines (31 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python
import optparse
import sys
from bashplotlib.utils.commandhelp import hist
from bashplotlib.utils.helpers import *
from bashplotlib.histogram import plot_hist
if __name__=="__main__":
parser = optparse.OptionParser(usage=hist['usage'])
parser.add_option('-f', '--file', help='a file containing a column of numbers',
default=None, dest='f')
parser.add_option('-t', '--title', help='title for the chart',
default="", dest='t')
parser.add_option('-b', '--bins', help='number of bins in the histogram',
type='int', default=None, dest='b')
parser.add_option('-s', '--height', help='height of the histogram (in lines)',
type='int', default=20., dest='h')
parser.add_option('-p', '--pch', help='shape of each bar', default='o', dest='p')
parser.add_option('-x', '--xlab', help='label bins on x-axis', default=None, action="store_true", dest='x')
parser.add_option('-c', '--colour', help='colour of the plot (%s)' % ", ".join([c for c in bcolours.keys() if c != 'ENDC']),
default='white', dest='colour')
parser.add_option('-n', '--nosummary', help='hide summary', action='store_false', dest='showSummary', default=True)
(opts, args) = parser.parse_args()
if opts.f is None:
if len(args) > 0:
opts.f = args[0]
else:
opts.f = sys.stdin.readlines()
if opts.f:
plot_hist(opts.f, opts.h, opts.b, opts.p, opts.colour, opts.t, opts.x, opts.showSummary)
else:
print "nothing to plot!"