changeset 116:fe820a3afa48

wip but we do need that new dependency
author Jeff Hammel <k0scist@gmail.com>
date Sun, 15 Mar 2015 20:18:00 -0700
parents 7fac47bb648e
children 0adf95bdda00
files numerics/bar.py setup.py
diffstat 2 files changed, 25 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/numerics/bar.py	Sun Mar 15 17:03:38 2015 -0700
+++ b/numerics/bar.py	Sun Mar 15 20:18:00 2015 -0700
@@ -20,11 +20,29 @@
 __all__ = ['bar_chart', 'BarChartParser', 'main']
 
 
-def bar_chart(data, output):
-    """create a bar chart"""
+def bar_chart(data, title=None):
+    """
+    create a bar chart
+
+    See:
+    - http://bokeh.pydata.org/en/latest/tutorial/solutions/gallery/olympics.html
+    """
+    # TODO:  abstract this to a plot class
+
+
+    # create a figure
+#    p1 = figure(title=title,
+#                tools="pan,wheel_zoom,box_zoom,reset,resize",
+#                x_range=data[0]
+#            )
+#    if not len(data) == 2:
+#        raise NotImplementedError('TODO') # -> record TODO items
+
+#    p1.rect(x=data[0], height=data[1])
+#    p1.show()
 
     bar = Bar(data, tools="pan,wheel_zoom,box_zoom,reset,resize")
-    bar.filename(output)
+#    bar.filename(output)
     bar.width(len(data)*50)
     bar.show()
 
@@ -55,10 +73,11 @@
         data.insert(0, range(len(data[-1])))
     if len(data) != 2:
         parser.error("A mapping is required")
-    mapping = OrderedDict(transpose(data))
+#    mapping = OrderedDict(transpose(data))
+
 
     # generate bar chart
-    bar_chart(mapping, options.output)
+    bar_chart(data, options.output)
 
 # BBB keeping this around for reference;
 # we should probably move to a better parsing system at some point
--- a/setup.py	Sun Mar 15 17:03:38 2015 -0700
+++ b/setup.py	Sun Mar 15 20:18:00 2015 -0700
@@ -10,7 +10,7 @@
 dependencies = ['numpy',
                 'pandas',
                 'matplotlib',
-                'bokeh']
+                'bokeh>=0.8.1']
 
 # allow use of setuptools/distribute or distutils
 kw = {}