How to use the termplotlib.barh._trim_trailing_zeros function in termplotlib

To help you get started, we’ve selected a few termplotlib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nschloe / termplotlib / termplotlib / hist.py View on Github external
else:
        k0 = 0

    if is_unicode_standard_output() and not force_ascii:
        block_chars = [" ", "▁", "▂", "▃", "▄", "▅", "▆", "▇", "█"]
        left_seven_eighths = "▉"
    else:
        block_chars = [" ", "*", "*", "*", "*", "*", "*", "*", "*"]
        left_seven_eighths = "*"

    # print text matrix
    out = []
    for row in _flip(matrix):

        # Cut off trailing zeros
        r = _trim_trailing_zeros(row)

        c = [block_chars[item] for item in r]

        # add grid lines
        for i in xgrid:
            # print(row[xgrid])
            pos = (i - k0) * bar_width - 1
            if row[pos] == 8 and (pos + 1 == len(row) or row[pos + 1] > 0):
                c[pos] = left_seven_eighths

        out.append("".join(c))

    return out