braille graphs: pep8 fixes
This commit is contained in:
parent
49d2f3bb0a
commit
117a2acfff
@ -385,17 +385,17 @@ def make_graph(values, upper_limit=100.0, style="blocks"):
|
||||
else:
|
||||
graph = ''.join(bar[int((n - mn) / extent * bar_count)] for n in values)
|
||||
elif style == 'braille':
|
||||
#idea from https://github.com/asciimoo/drawille
|
||||
#unicode values from http://en.wikipedia.org/wiki/Braille
|
||||
# idea from https://github.com/asciimoo/drawille
|
||||
# unicode values from http://en.wikipedia.org/wiki/Braille
|
||||
v2 = values if len(values) % 2 == 0 else values + [mn]
|
||||
l = len(v2) // 2
|
||||
if extent == 0:
|
||||
graph = chr(0x2800) * l #should be visually equiv to ' '
|
||||
graph = chr(0x2800) * l # should be visually equiv to ' '
|
||||
else:
|
||||
graph = ''
|
||||
for i in range(0, l, 2):
|
||||
b1 = [ 0, 0x40, 0x44, 0x46, 0x47 ][ round(4 * (v2[i] - mn) / extent) ]
|
||||
b2 = [ 0, 0x80, 0xa0, 0xb0, 0xb8 ][ round(4 * (v2[i + 1] - mn) / extent) ]
|
||||
b1 = [0, 0x40, 0x44, 0x46, 0x47][round(4 * (v2[i] - mn) / extent)]
|
||||
b2 = [0, 0x80, 0xa0, 0xb0, 0xb8][round(4 * (v2[i + 1] - mn) / extent)]
|
||||
graph += chr(0x2800 + b1 + b2)
|
||||
else:
|
||||
raise NotImplementedError("Graph drawing style '%s' unimplemented." % style)
|
||||
|
Loading…
Reference in New Issue
Block a user