forked from glamp/bashplotlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo.py
More file actions
26 lines (22 loc) · 795 Bytes
/
demo.py
File metadata and controls
26 lines (22 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""demo.py
"""
import os, sys
from bashplotlib.cli.hist import __doc__ as HIST_DOCSTRING
from bashplotlib.core.histogram import plot_hist
from bashplotlib import PROJECT_ROOT
DATA_PATH = os.path.realpath(os.path.join(PROJECT_ROOT, '..', 'data'))
if not os.path.exists(DATA_PATH):
sys.stderr.write('You need to download the example data set to run the demo...')
sys.stderr.write('try running `./examples/downloaddata.sh` to get the data')
sys.exit(1)
def _hist_demo():
f = os.path.join(DATA_PATH, 'exp.txt')
print f
plot_hist(f)
def run_demo(command):
if command == "hist":
_hist_demo()
elif command == "scatter":
raise NotImplementedError('`run_demo` is only implemented for `hist` cmd so far.')