MCPcopy Index your code
hub / github.com/glamp/bashplotlib / abbreviate

Function abbreviate

bashplotlib/utils/helpers.py:69–78  ·  view source on GitHub ↗

Abbreviate labels without introducing ambiguities.

(labels, rfill=' ')

Source from the content-addressed store, hash-verified

67
68
69def abbreviate(labels, rfill=' '):
70 """
71 Abbreviate labels without introducing ambiguities.
72 """
73 max_len = max(len(l) for l in labels)
74 for i in range(1, max_len):
75 abbrev = [l[:i].ljust(i, rfill) for l in labels]
76 if len(abbrev) == len(set(abbrev)):
77 break
78 return abbrev
79
80
81def box_text(text, width, offset=0):

Callers 1

plot_histFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected