def genplot()

in doc/FormattingDecisionComments/columns.py [0:0]


def genplot(name, path):
    out = os.popen(f"./columns.sh {path}").read()
    csvfile = StringIO(out)
    reader = csv.reader(csvfile, delimiter=',')
    rows = [row for row in reader]

    spaces = [int(row[0]) for row in rows]
    counts = [int(row[1]) for row in rows]
    total = sum(counts)
    percentages = [(c * 100) / total for c in counts]
    # filter out insignificant numbers, counts less than 10 and percentages less than 1
    filtered = [(s, p) for (s, c, p) in zip(spaces, counts, percentages) if p >= 1 and c >= 10]
    xs = [x for (x, y) in filtered]
    ys = [y for (x, y) in filtered]
    print("{")
    print(f"x: {xs},")
    print(f"y: {ys},")
    print("mode: 'markers',")
    print("type: 'scatter',")
    print(f"name: '{name}'")
    print("},")