Skip to content

Commit e8aa977

Browse files
author
Mackenzie
committed
modify x-label printouts
trim x-labels to smallest non-zero decimal, and drop decimal place if the x-value is an integer
1 parent 6871f05 commit e8aa977

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

bashplotlib/histogram.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ def calc_bins(n, min_val, max_val, h=None, binwidth=None):
1414
if binwidth is None:
1515
binwidth = (max_val - min_val) / h
1616
for b in drange(min_val, max_val, step=binwidth, include_stop=True):
17-
yield b
17+
if b.is_integer():
18+
yield int(b)
19+
else:
20+
yield b
1821

1922
def read_numbers(numbers):
2023
"read the input data in the most optimal way"

0 commit comments

Comments
 (0)