How to use the termplotlib.barh._get_matrix_of_eighths 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
def hist_vertical(
    counts,
    bins=30,
    max_height=10,
    bar_width=2,
    strip=False,
    xgrid=None,
    force_ascii=False,
):
    if xgrid is None:
        xgrid = []

    matrix = _get_matrix_of_eighths(counts, max_height, bar_width)

    if strip:
        # Cut off leading and trailing rows of 0
        k0 = 0
        for row in matrix:
            if any([item != 0 for item in row]):
                break
            k0 += 1

        k1 = 0
        for row in matrix[::-1]:
            if any([item != 0 for item in row]):
                break
            k1 += 1
        n = len(matrix)
        matrix = matrix[k0 : n - k1]