r80325 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80324‎ | r80325 | r80326 >
Date:21:12, 14 January 2011
Author:rfaulk
Status:deferred
Tags:
Comment:
added a legend to the confidence plots
Modified paths:
  • /trunk/fundraiser-statistics/fundraiser-scripts/compute_confidence.py (modified) (history)

Diff [purge]

Index: trunk/fundraiser-statistics/fundraiser-scripts/compute_confidence.py
@@ -185,18 +185,19 @@
186186
187187 plot the test results with errorbars
188188 """
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):
190190
191191 pylab.subplot(subplot_index)
192192 pylab.figure(num=None,figsize=[26,14])
193193
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')
196196 # pylab.hist(counts, times)
197197
198198 pylab.grid()
 199+ pylab.ylim(ranges[2], ranges[3])
199200 pylab.xlim(ranges[0], ranges[1])
200 - pylab.ylim(ranges[2], ranges[3])
 201+ pylab.legend([e1[0], e2[0]], labels,loc=2)
201202
202203 pylab.xlabel(xlabel)
203204 pylab.ylabel(ylabel)
@@ -223,6 +224,20 @@
224225 std_devs_2 = ret[3]
225226 confidence = ret[4]
226227
 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+
227242 #print means_1
228243 #print means_2
229244 #print std_devs_1
@@ -244,7 +259,8 @@
245260 ranges = [-0.5, max_x, 0, max_y]
246261
247262 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)
249265
250266 return
251267

Status & tagging log