aboutsummaryrefslogtreecommitdiffstats
path: root/plot/style.py
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-04-27 15:34:13 -0400
committerJonathan Herman <hermanjl@cs.unc.edu>2013-04-27 15:34:13 -0400
commit3f706cd240d039365cbb8f9975ad97480d8b6145 (patch)
tree1cdcbaf78b84c7a6383505896e89e29574cf65b2 /plot/style.py
parent15f231a79320cbc97cd88d8a4751515a47ce223e (diff)
Fixes.
Diffstat (limited to 'plot/style.py')
-rw-r--r--plot/style.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/plot/style.py b/plot/style.py
index 4e2057f..5c2d661 100644
--- a/plot/style.py
+++ b/plot/style.py
@@ -1,7 +1,7 @@
1from collections import namedtuple 1from collections import namedtuple
2import matplotlib.pyplot as plot 2import matplotlib.pyplot as plot
3 3
4class Style(namedtuple('SS', ['marker', 'line', 'color'])): 4class Style(namedtuple('SS', ['marker', 'color', 'line'])):
5 def fmt(self): 5 def fmt(self):
6 return self.marker + self.line + self.color 6 return self.marker + self.line + self.color
7 7
@@ -24,11 +24,12 @@ class StyleMap(object):
24 t = float if float(value) % 1.0 else int 24 t = float if float(value) % 1.0 else int
25 except: 25 except:
26 t = bool if value in ['True','False'] else str 26 t = bool if value in ['True','False'] else str
27 return StyleMap.ORDER.index(t) 27 # return StyleMap.ORDER.index(t)
28 col_list = sorted(col_list, key=type_priority) 28 return len(col_values[column])
29 col_list = sorted(col_list, key=type_priority, reverse=True)
29 30
30 # TODO: undo this, switch to popping mechanism 31 # TODO: undo this, switch to popping mechanism
31 for field, values in reversed([x for x in self.__get_all()._asdict().iteritems()]): 32 for field, values in [x for x in self.__get_all()._asdict().iteritems()]:
32 if not col_list: 33 if not col_list:
33 break 34 break
34 35
@@ -36,7 +37,10 @@ class StyleMap(object):
36 value_dict = {} 37 value_dict = {}
37 38
38 for value in sorted(col_values[next_column]): 39 for value in sorted(col_values[next_column]):
39 value_dict[value] = values.pop(0) 40 try:
41 value_dict[value] = values.pop(0)
42 except Exception as e:
43 raise e
40 44
41 self.value_map[next_column] = value_dict 45 self.value_map[next_column] = value_dict
42 self.field_map[next_column] = field 46 self.field_map[next_column] = field
@@ -44,7 +48,7 @@ class StyleMap(object):
44 def __get_all(self): 48 def __get_all(self):
45 '''A Style holding all possible values for each property.''' 49 '''A Style holding all possible values for each property.'''
46 return Style(marker=list('.,ov^<>1234sp*hH+xDd|_'), 50 return Style(marker=list('.,ov^<>1234sp*hH+xDd|_'),
47 line=['-', ':', '--'], 51 line=['-', ':', '--', '_'],
48 color=list('bgrcmyk')) 52 color=list('bgrcmyk'))
49 53
50 def get_style(self, kv): 54 def get_style(self, kv):