Skip to content

Commit e15f071

Browse files
committed
Merge pull request glamp#11 from mc818/max_values
max values and y-val of 0
2 parents 6bf4681 + ccfde87 commit e15f071

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

bashplotlib/histogram.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,15 @@ def plot_hist(f, height=20.0, bincount=None, pch="o", colour="white", title="",
8686
hist[i] = 0
8787
for number in read_numbers(f):
8888
for i, b in enumerate(bins):
89-
if number < b:
89+
if number <= b:
9090
hist[i] += 1
9191
break
92+
if number == max_val and max_val > bins[len(bins) - 1]:
93+
hist[len(hist) - 1] += 1
9294

9395
min_y, max_y = min(hist.values()), max(hist.values())
9496

95-
ys = list(drange(min_y, max_y, (max_y-min_y)/height))
97+
ys = list(drange(max(min_y, 1), max_y + 1, (max_y-min_y)/height))
9698
ys.reverse()
9799

98100
nlen = max(len(str(min_y)), len(str(max_y))) + 1
@@ -112,7 +114,7 @@ def plot_hist(f, height=20.0, bincount=None, pch="o", colour="white", title="",
112114
print ylab,
113115

114116
for i in range(len(hist)):
115-
if y < hist[i]:
117+
if int(y) <= hist[i]:
116118
printcolor(pch, True, colour)
117119
else:
118120
printcolor(" ", True, colour)

0 commit comments

Comments
 (0)