Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation to use termgraph as python module within python script #96

Open
davytan07 opened this issue May 7, 2022 · 0 comments
Open

Comments

@davytan07
Copy link

Hi, is there any documentation for how to use termgraph within a .py script instead of on the terminal? Was searching for any form of documentation online, and I found the following code which works, thus I was wondering how I could do the same on a .py script for horizontal graphs:

from termgraph import termgraph as tg

labels = ['2007', '2008', '2009', '2010', '2011', '2012', '2014']
data = [[183.32, 190.52], [231.23, 5.0], [16.43, 53.1], [50.21, 7.0], [508.97, 10.45], [212.05, 20.2], [30.0, 20.0]]
normal_data = [[48.059508408796894, 50.0], [60.971862871927556, 0.0],
[3.080530401034929, 12.963561880120743],
[12.184670116429496, 0.5390254420008624],
[135.82632600258734, 1.4688443294523499],
[55.802608883139285, 4.096593359206555],
[6.737818025010781, 4.042690815006468]]
len_categories = 2
args = {'filename': 'data/ex4.dat', 'title': None, 'width': 50,
'format': '{:<5.2f}', 'suffix': '', 'no_labels': True,
'color': None, 'vertical': False, 'stacked': True,
'different_scale': False, 'calendar': False,
'start_dt': None, 'custom_tick': '', 'delim': '',
'verbose': False, 'version': False}
colors = [91, 94]
tg.stacked_graph(labels, data, normal_data, len_categories, args, colors)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant