Skip to content

Commit 7079a4d

Browse files
committed
added error catching
1 parent 1a0bcd3 commit 7079a4d

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

bin/hist.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,18 @@ def plot_hist(f, height=20, bincount=None, pch="o", colour="white", title=""):
7676

7777
print " "*(nlen+1) + "-"*len(xs)
7878

79-
for i in range(0, nlen):
80-
printcolor(" "*(nlen+1), True, colour)
81-
for x in range(0, len(hist)):
82-
num = str(bins[x])
83-
if x%2==0:
84-
print " ",
85-
elif i < len(num):
86-
print num[i],
87-
print
88-
89-
summary = "Summary\n--------\nMax: %s\nMin: %s\nCount: %s" % (min_val, max_val, int(n))
90-
print summary
79+
# for i in range(0, nlen):
80+
# printcolor(" "*(nlen+1), True, colour)
81+
# for x in range(0, len(hist)):
82+
# num = str(bins[x])
83+
# if x%2==0:
84+
# print " ",
85+
# elif i < len(num):
86+
# print num[i],
87+
# print
88+
#
89+
# summary = "Summary\n--------\nMax: %s\nMin: %s\nCount: %s" % (min_val, max_val, int(n))
90+
# print summary
9191

9292

9393
if __name__=="__main__":
@@ -110,5 +110,8 @@ def plot_hist(f, height=20, bincount=None, pch="o", colour="white", title=""):
110110
if opts.f is None:
111111
opts.f = args[0]
112112

113-
plot_hist(opts.f, opts.h, opts.b, opts.p, opts.colour, opts.t)
113+
if opts.f:
114+
plot_hist(opts.f, opts.h, opts.b, opts.p, opts.colour, opts.t)
115+
else:
116+
print "nothing to plot!"
114117

bin/scatter.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ def plot_scatter(f, xs, ys, size, pch, colour, title):
7272
default='white', dest='colour')
7373

7474
(opts, args) = parser.parse_args()
75-
76-
plot_scatter(opts.f, opts.x, opts.y, opts.size, opts.pch, opts.colour, opts.t)
75+
76+
if opts.f or (opts.x and opts.y):
77+
plot_scatter(opts.f, opts.x, opts.y, opts.size, opts.pch, opts.colour, opts.t)
78+
else:
79+
print "nothing to plot!"
7780

0 commit comments

Comments
 (0)