Skip to content

Commit da60206

Browse files
committed
updated usage
1 parent 9d9db78 commit da60206

File tree

4 files changed

+35
-17
lines changed

4 files changed

+35
-17
lines changed

bashplotlib/histogram.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def run_demo():
5050
print "hist -f ./data/exp.txt -s 35.0 -b 40"
5151
plot_hist('./data/exp.txt', height=35.0, bincount=40)
5252

53-
def plot_hist(f, height=20.0, bincount=None, pch="o", colour="white", title="", xlab=None):
53+
def plot_hist(f, height=20.0, bincount=None, pch="o", colour="white", title="", xlab=None, nosummary=True):
5454
"plot a histogram given a file of numbers"
5555
if pch is None:
5656
pch = "o"
@@ -121,16 +121,18 @@ def plot_hist(f, height=20.0, bincount=None, pch="o", colour="white", title="",
121121
print
122122
center = max(map(len, map(str, [n, min_val, mean, max_val])))
123123
center += 15
124-
print
125-
print "-"*(2 + center)
126-
print "|" + "Summary".center(center) + "|"
127-
print "-"*(2 + center)
128-
summary = "|" + ("observations: %d" % n).center(center) + "|\n"
129-
summary += "|" + ("min value: %f" % min_val).center(center) + "|\n"
130-
summary += "|" + ("mean : %f" % mean).center(center) + "|\n"
131-
summary += "|" + ("max value: %f" % max_val).center(center) + "|\n"
132-
summary += "-"*(2 + center)
133-
print summary
124+
125+
if nosummary is not True:
126+
print
127+
print "-"*(2 + center)
128+
print "|" + "Summary".center(center) + "|"
129+
print "-"*(2 + center)
130+
summary = "|" + ("observations: %d" % n).center(center) + "|\n"
131+
summary += "|" + ("min value: %f" % min_val).center(center) + "|\n"
132+
summary += "|" + ("mean : %f" % mean).center(center) + "|\n"
133+
summary += "|" + ("max value: %f" % max_val).center(center) + "|\n"
134+
summary += "-"*(2 + center)
135+
print summary
134136

135137

136138
if __name__=="__main__":
@@ -150,9 +152,10 @@ def plot_hist(f, height=20.0, bincount=None, pch="o", colour="white", title="",
150152
parser.add_option('-c', '--colour', help='colour of the plot (%s)' % ", ".join([c for c in bcolours.keys() if c != 'ENDC']),
151153
default='white', dest='colour')
152154
parser.add_option('-d', '--demo', help='run demos', action='store_true', dest='demo')
155+
parser.add_option('-n', '--nosummary', help='run demos', action='store_true', dest='nosummary')
153156

154157
(opts, args) = parser.parse_args()
155-
158+
156159
if opts.f is None:
157160
if len(args) > 0:
158161
opts.f = args[0]
@@ -162,7 +165,7 @@ def plot_hist(f, height=20.0, bincount=None, pch="o", colour="white", title="",
162165
if opts.demo:
163166
run_demo()
164167
elif opts.f:
165-
plot_hist(opts.f, opts.h, opts.b, opts.p, opts.colour, opts.t, opts.x)
168+
plot_hist(opts.f, opts.h, opts.b, opts.p, opts.colour, opts.t, opts.x, opts.nosummary)
166169
else:
167170
print "nothing to plot!"
168171

bashplotlib/utils/commandhelp.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
11

22
hist = {
3-
"usage": "this is a histogram"
3+
"usage": """hist is a command for making histograms. it accepts a series of values in one of the following formats:
4+
1) txt file w/ 1 column of numbers
5+
2) standard in piped from another command line cat or curl
6+
7+
for some examples of how to use hist, you can type the command:
8+
hist --demo
9+
or visit https://github.com/glamp/bashplotlib/blob/master/examples/sample.sh
10+
"""
411
}
512

613
scatter = {
7-
"usage": "this is a scatterplot"
14+
"usage": """scatterplot is a command for making xy plots. it accepts a series of x values and a series of y values in the
15+
following formats:
16+
1) a txt file or standard in value w/ 2 comma seperated columns of x,y values
17+
2) 2 txt files. 1 w/ designated x values and another with designated y values.
18+
19+
scatter -x <xcoords> -y <ycoords>
20+
cat <file_with_x_and_y_coords> | scatter
21+
22+
"""
823
}
924

bashplotlib/utils/commandhelp.pyc

756 Bytes
Binary file not shown.

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33

44
setup(
55
name="bashplotlib",
6-
version="0.3.4",
6+
version="0.3.5",
77
author="Greg Lamp",
88
author_email="lamp.greg@gmail.com",
99
url="https://github.com/glamp/bashplotlib",
1010
license=open("LICENSE.txt").read(),
1111
packages=find_packages(),
12-
description="plotting from the command line",
12+
description="plotting in the terminal",
1313
long_description=open("README.txt").read(),
1414
scripts=['bin/hist', 'bin/scatter'],
1515
)

0 commit comments

Comments
 (0)