Index: trunk/fundraiser-statistics/fundraiser-scripts/compute_confidence.py |
— | — | @@ -185,18 +185,19 @@ |
186 | 186 | |
187 | 187 | plot the test results with errorbars |
188 | 188 | """ |
189 | | - def gen_plot(self,means_1, means_2, std_devs_1, std_devs_2, times_indices, title, xlabel, ylabel, ranges, subplot_index, fname): |
| 189 | + def gen_plot(self,means_1, means_2, std_devs_1, std_devs_2, times_indices, title, xlabel, ylabel, ranges, subplot_index, labels, fname): |
190 | 190 | |
191 | 191 | pylab.subplot(subplot_index) |
192 | 192 | pylab.figure(num=None,figsize=[26,14]) |
193 | 193 | |
194 | | - pylab.errorbar(times_indices, means_1, yerr=std_devs_1, fmt='-xb') |
195 | | - pylab.errorbar(times_indices, means_2, yerr=std_devs_2, fmt='-dr') |
| 194 | + e1 = pylab.errorbar(times_indices, means_1, yerr=std_devs_1, fmt='-xb') |
| 195 | + e2 = pylab.errorbar(times_indices, means_2, yerr=std_devs_2, fmt='-dr') |
196 | 196 | # pylab.hist(counts, times) |
197 | 197 | |
198 | 198 | pylab.grid() |
| 199 | + pylab.ylim(ranges[2], ranges[3]) |
199 | 200 | pylab.xlim(ranges[0], ranges[1]) |
200 | | - pylab.ylim(ranges[2], ranges[3]) |
| 201 | + pylab.legend([e1[0], e2[0]], labels,loc=2) |
201 | 202 | |
202 | 203 | pylab.xlabel(xlabel) |
203 | 204 | pylab.ylabel(ylabel) |
— | — | @@ -223,6 +224,20 @@ |
224 | 225 | std_devs_2 = ret[3] |
225 | 226 | confidence = ret[4] |
226 | 227 | |
| 228 | + # Pad data with beginning and end points |
| 229 | + times_indices.insert(len(times_indices), math.ceil(times_indices[-1])) |
| 230 | + times_indices.insert(0, 0) |
| 231 | + |
| 232 | + means_1.insert(len(means_1),means_1[-1]) |
| 233 | + means_2.insert(len(means_2),means_2[-1]) |
| 234 | + means_1.insert(0,means_1[0]) |
| 235 | + means_2.insert(0,means_2[0]) |
| 236 | + |
| 237 | + std_devs_1.insert(len(std_devs_1),0) |
| 238 | + std_devs_2.insert(len(std_devs_2),0) |
| 239 | + std_devs_1.insert(0,0) |
| 240 | + std_devs_2.insert(0,0) |
| 241 | + |
227 | 242 | #print means_1 |
228 | 243 | #print means_2 |
229 | 244 | #print std_devs_1 |
— | — | @@ -244,7 +259,8 @@ |
245 | 260 | ranges = [-0.5, max_x, 0, max_y] |
246 | 261 | |
247 | 262 | ylabel = metric_name |
248 | | - self.gen_plot(means_1, means_2, std_devs_1, std_devs_2, times_indices, title, xlabel, ylabel, ranges, subplot_index, fname) |
| 263 | + labels = [item_1, item_2] |
| 264 | + self.gen_plot(means_1, means_2, std_devs_1, std_devs_2, times_indices, title, xlabel, ylabel, ranges, subplot_index, labels, fname) |
249 | 265 | |
250 | 266 | return |
251 | 267 | |