Closed ghost closed 3 years ago
all_float
is not necessary, just use the else
block.
Good point, fixed.
This needs a test, too.
The code below was run with the modifications of the last commit:
python3 << 'EOF'
import termplotlib as tpl
data = ([3.05, 10.1, 5.00756], ['Water', 'Milk', 'Juice'])
fig = tpl.figure()
fig.barh(*data, force_ascii=True)
fig.show()
data = ([3, 10, 5], ['Water', 'Milk', 'Juice'])
fig = tpl.figure()
fig.barh(*data, force_ascii=True)
fig.show()
EOF
Water [ 3.05000] *************
Milk [10.10000] ****************************************
Juice [ 5.00756] ********************
Water [ 3] ************
Milk [10] ****************************************
Juice [ 5] ********************
Closing in favor of #72.
This adds a formatting similar to what is already implemented for the integers when using float in
barh
:Before :
After:
Each float value now uses the same width producing a better alignment of the bars.
Test script: