changeset 159:f46cfad55d7a

hack to include numbers in our bar charts
author Jeff Hammel <k0scist@gmail.com>
date Wed, 13 May 2015 15:00:44 -0700
parents 176aad184ad0
children 3bcd097c27f2
files numerics/bar.py
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/numerics/bar.py	Tue May 12 16:51:10 2015 -0700
+++ b/numerics/bar.py	Wed May 13 15:00:44 2015 -0700
@@ -60,6 +60,9 @@
         ManipulationParser.__init__(self, **kwargs)
         self.add_argument('-t', '--title', dest='title',
                           help="plot title")
+        self.add_argument('-u', '--use-numbers', dest='use_numbers',
+                          action='store_true', default=False,
+                          help="include numbers with the labels")
 
 
 def main(args=sys.argv[1:]):
@@ -76,8 +79,11 @@
     if len(data) == 1:
         data = data[0]
         labels = None
-    elif len(data) ==2:
-        labels = data[0]
+    elif len(data) == 2:
+        if options.use_numbers:
+            labels = ['{} : {}'.format(label, value) for label, value in zip(*data)]
+        else:
+            labels = data[0]
         data = data[1]
     else:
         raise NotImplementedError('TODO')