@@ -36,6 +36,9 @@ def main():
36
36
parser .add_argument ('--alternative-palette' , dest = 'use_alt_palette' ,
37
37
action = 'store_true' , default = False ,
38
38
help = "Use another color palette" )
39
+ parser .add_argument ('--errorbars' , dest = 'display_errorbars' ,
40
+ action = 'store_true' , default = False ,
41
+ help = "Display errorbars" )
39
42
args = parser .parse_args ()
40
43
41
44
distribution_names = {
@@ -73,8 +76,8 @@ def main():
73
76
size = int (size )
74
77
distribution = distribution_names [distribution ]
75
78
results = [int (result ) for result in results ]
76
- if not size in data : data [ size ] = {}
77
- if not distribution in data [size ]: data [ size ][ distribution ] = {}
79
+ data . setdefault ( size , {})
80
+ data [size ]. setdefault ( distribution , {})
78
81
data [size ][distribution ][algo ] = results
79
82
80
83
# Choose the colour palette and markers to use
@@ -112,14 +115,15 @@ def main():
112
115
for i , algo in enumerate (algos ):
113
116
heights = [numpy .median (data [size ][distribution ][algo ]) for distribution in distributions ]
114
117
errors = [numpy .std (data [size ][distribution ][algo ]) for distribution in distributions ]
118
+ kwargs = {"xerr" : errors } if args .display_errorbars else {}
115
119
pyplot .barh ([barwidth * i + groupwidth * n for n in range (len (distributions ))],
116
- heights , 0.6 , color = next (colors ), label = algo )
120
+ heights , 0.6 , color = next (colors ), label = algo , ** kwargs )
117
121
118
122
# Set axes limits and labels.
119
123
groupnames = ['\n ' .join (wrap (l , 11 )) for l in groupnames ]
120
124
pyplot .yticks ([barwidth * groupsize / 2 + groupwidth * n for n in range (len (groupnames ))],
121
125
groupnames , horizontalalignment = 'center' )
122
- pyplot .xlabel ("Cycles per element" )
126
+ pyplot .xlabel ("Cycles per element (lower is better) " )
123
127
124
128
# Turn off ticks for y-axis.
125
129
pyplot .tick_params (axis = "y" ,
0 commit comments