Skip to content

Commit 2ca77b8

Browse files
committed
Fix hist ranges for below 1 and/or above 0 bins
1 parent e36459e commit 2ca77b8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

plotille.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,8 @@ def _hist(X, bins): # noqa: N803
215215
counts: List[int] The counts for all bins.
216216
bins: List[float] The range for each bin: bin `i` is in [bins[i], bins[i+1])
217217
'''
218-
xmin, xmax = min([0] + X), max([1] + X)
218+
xmin = min(X) if len(X) > 0 else 0
219+
xmax = max(X) if len(X) > 0 else 1
219220
xwidth = abs((xmax - xmin) / bins)
220221

221222
y = [0] * bins

0 commit comments

Comments
 (0)