How to use the termgraph.termgraph.horiz_rows function in termgraph

To help you get started, we’ve selected a few termgraph 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 mkaz / termgraph / tests / test_termgraph.py View on Github external
[124.80402542372879, 28.813559322033893, 45.02118644067796],
                          [11.032838983050844, 30.455508474576266, 42.87076271186441],
                          [28.924788135593214, 6.038135593220338, 2.330508474576271],
                          [271.9120762711864, 7.865466101694914, 6.038135593220338],
                          [114.64512711864406, 13.02966101694915, 0.0],
                          [18.220338983050844, 7.097457627118644, 7.521186440677965]]
            args = {'filename': 'data/ex5.dat', 'title': None, 'width': 50,
                    'format': '{:<5.2f}', 'suffix': '', 'no_labels': False,
                    'color': None, 'vertical': False, 'stacked': False,
                    'different_scale': False, 'calendar': False, 'start_dt': None,
                    'custom_tick': '', 'delim': '', 'verbose': False,
                    'version': False}
            colors = [None, None, None]

            rows = []
            for row in tg.horiz_rows(labels, data, normal_dat, args, colors):
                rows.append(row)
            assert rows == [(183.32, 99, -4.4, None), (190.52, 103, -4.4, None),
                            (90.0, 49, -4.4, None), (231.23, 124, -4.4, None),
                            (50.0, 28, -4.4, None), (80.6, 45, -4.4, None),
                            (16.43, 11, -4.4, None), (53.1, 30, -4.4, None),
                            (76.54, 42, -4.4, None), (50.21, 28, -4.4, None),
                            (7.0, 6, -4.4, None), (0.0, 2, -4.4, None),
                            (508.97, 271, -4.4, None), (10.45, 7, -4.4, None),
                            (7.0, 6, -4.4, None), (212.05, 114, -4.4, None),
                            (20.2, 13, -4.4, None), (-4.4, 0, -4.4, None),
                            (30.0, 18, -4.4, None), (9.0, 7, -4.4, None),
                            (9.8, 7, -4.4, None)]
            output = output.getvalue().strip()
            assert output == '2007:  183.32\n       190.52\n       90.00\n2008:  231.23\n       50.00\n       80.60\n2009:  16.43\n       53.10\n       76.54\n2010:  50.21\n       7.00 \n       0.00 \n2011:  508.97\n       10.45\n       7.00 \n2012:  212.05\n       20.20\n       -4.40\n2014:  30.00\n       9.00 \n       9.80'
github mkaz / termgraph / tests / test_termgraph.py View on Github external
'2012', '2014']
            data = [[183.32], [231.23], [16.43], [50.21], [508.97],
                    [212.05], [1.0]]
            normal_dat = [[17.94594168946985], [22.661771364450654],
                          [1.5187904797527412], [4.843789987597693],
                          [50.0], [20.77386459830305], [0.0]]
            args = {'filename': 'data/ex1.dat', 'title': None,
                    'width': 50, 'format': '{:<5.2f}', 'suffix': '',
                    'no_labels': True, 'color': None, 'vertical': False,
                    'stacked': False, 'different_scale': False,
                    'calendar': False, 'start_dt': None, 'custom_tick': '',
                    'delim': '', 'verbose': False, 'version': False}
            colors = []

            rows = []
            for row in tg.horiz_rows(labels, data, normal_dat, args, colors):
                rows.append(row)
            assert rows == [(183.32, 17, 1.0, None), (231.23, 22, 1.0, None),
                            (16.43, 1, 1.0, None), (50.21, 4, 1.0, None),
                            (508.97, 50, 1.0, None), (212.05, 20, 1.0, None),
                            (1.0, 0, 1.0, None)]
            output = output.getvalue().strip()
            assert output == '183.32\n 231.23\n 16.43\n 50.21\n 508.97\n 212.05\n 1.00'
github mkaz / termgraph / tests / test_termgraph.py View on Github external
'2012', '2014']
        data = [[183.32], [231.23], [16.43], [50.21], [508.97],
                [212.05], [1.0]]
        normal_dat = [[17.94594168946985], [22.661771364450654],
                      [1.5187904797527412], [4.843789987597693],
                      [50.0], [20.77386459830305], [0.0]]
        args = {'filename': 'data/ex1.dat', 'title': None,
                'width': 50, 'format': '{:<5.2f}', 'suffix': '',
                'no_labels': False, 'color': None, 'vertical': False,
                'stacked': False, 'different_scale': False,
                'calendar': False, 'start_dt': None, 'custom_tick': '',
                'delim': '', 'verbose': False, 'version': False}
        colors = []

        rows = []
        for row in tg.horiz_rows(labels, data, normal_dat, args, colors):
            rows.append(row)
        assert rows == [(183.32, 17, 1.0, None), (231.23, 22, 1.0, None),
                        (16.43, 1, 1.0, None), (50.21, 4, 1.0, None),
                        (508.97, 50, 1.0, None), (212.05, 20, 1.0, None),
                        (1.0, 0, 1.0, None)]