|
|
@ -49,8 +49,8 @@ class Box(Graph): |
|
|
|
""" |
|
|
|
""" |
|
|
|
if self.box_mode == "extremes": |
|
|
|
if self.box_mode == "extremes": |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
'Min: %s\nQ1 : %s\nQ2 : %s\nQ3 : %s\nMax: %s' % |
|
|
|
'Min: %s\nQ1 : %s\nQ2 : %s\nQ3 : %s\nMax: %s' % tuple( |
|
|
|
tuple(map(self._y_format, serie.points[1:6]))) |
|
|
|
map(self._y_format, serie.points[1:6]))) |
|
|
|
elif self.box_mode in ["tukey", "stdev", "pstdev"]: |
|
|
|
elif self.box_mode in ["tukey", "stdev", "pstdev"]: |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
'Min: %s\nLower Whisker: %s\nQ1: %s\nQ2: %s\nQ3: %s\n' |
|
|
|
'Min: %s\nLower Whisker: %s\nQ1: %s\nQ2: %s\nQ3: %s\n' |
|
|
@ -166,7 +166,7 @@ class Box(Graph): |
|
|
|
alter(self.svg.node( |
|
|
|
alter(self.svg.node( |
|
|
|
parent_node, |
|
|
|
parent_node, |
|
|
|
tag='circle', |
|
|
|
tag='circle', |
|
|
|
cx=left_edge+width/2, |
|
|
|
cx=left_edge + width / 2, |
|
|
|
cy=self.view.y(o), |
|
|
|
cy=self.view.y(o), |
|
|
|
r=3, |
|
|
|
r=3, |
|
|
|
class_='subtle-fill reactive tooltip-trigger'), metadata) |
|
|
|
class_='subtle-fill reactive tooltip-trigger'), metadata) |
|
|
@ -241,12 +241,12 @@ class Box(Graph): |
|
|
|
q3 = s[0] |
|
|
|
q3 = s[0] |
|
|
|
elif n % 4 == 1: # n is of form 4n + 1 where n >= 1 |
|
|
|
elif n % 4 == 1: # n is of form 4n + 1 where n >= 1 |
|
|
|
m = (n - 1) // 4 |
|
|
|
m = (n - 1) // 4 |
|
|
|
q1 = 0.25 * s[m-1] + 0.75 * s[m] |
|
|
|
q1 = 0.25 * s[m - 1] + 0.75 * s[m] |
|
|
|
q3 = 0.75 * s[3*m] + 0.25 * s[3*m+1] |
|
|
|
q3 = 0.75 * s[3 * m] + 0.25 * s[3 * m + 1] |
|
|
|
else: # n is of form 4n + 3 where n >= 1 |
|
|
|
else: # n is of form 4n + 3 where n >= 1 |
|
|
|
m = (n - 3) // 4 |
|
|
|
m = (n - 3) // 4 |
|
|
|
q1 = 0.75 * s[m] + 0.25 * s[m+1] |
|
|
|
q1 = 0.75 * s[m] + 0.25 * s[m + 1] |
|
|
|
q3 = 0.25 * s[3*m+1] + 0.75 * s[3*m+2] |
|
|
|
q3 = 0.25 * s[3 * m + 1] + 0.75 * s[3 * m + 2] |
|
|
|
|
|
|
|
|
|
|
|
iqr = q3 - q1 |
|
|
|
iqr = q3 - q1 |
|
|
|
min_s = s[0] |
|
|
|
min_s = s[0] |
|
|
@ -261,7 +261,7 @@ class Box(Graph): |
|
|
|
b0 = bisect_left(s, q1 - 1.5 * iqr) |
|
|
|
b0 = bisect_left(s, q1 - 1.5 * iqr) |
|
|
|
b4 = bisect_right(s, q3 + 1.5 * iqr) |
|
|
|
b4 = bisect_right(s, q3 + 1.5 * iqr) |
|
|
|
q0 = s[b0] |
|
|
|
q0 = s[b0] |
|
|
|
q4 = s[b4-1] |
|
|
|
q4 = s[b4 - 1] |
|
|
|
outliers = s[:b0] + s[b4:] |
|
|
|
outliers = s[:b0] + s[b4:] |
|
|
|
elif mode == 'stdev': |
|
|
|
elif mode == 'stdev': |
|
|
|
# one standard deviation above and below the mean of the data |
|
|
|
# one standard deviation above and below the mean of the data |
|
|
@ -269,7 +269,7 @@ class Box(Graph): |
|
|
|
b0 = bisect_left(s, q2 - sd) |
|
|
|
b0 = bisect_left(s, q2 - sd) |
|
|
|
b4 = bisect_right(s, q2 + sd) |
|
|
|
b4 = bisect_right(s, q2 + sd) |
|
|
|
q0 = s[b0] |
|
|
|
q0 = s[b0] |
|
|
|
q4 = s[b4-1] |
|
|
|
q4 = s[b4 - 1] |
|
|
|
outliers = s[:b0] + s[b4:] |
|
|
|
outliers = s[:b0] + s[b4:] |
|
|
|
elif mode == 'pstdev': |
|
|
|
elif mode == 'pstdev': |
|
|
|
# one population standard deviation above and below |
|
|
|
# one population standard deviation above and below |
|
|
@ -278,7 +278,7 @@ class Box(Graph): |
|
|
|
b0 = bisect_left(s, q2 - sdp) |
|
|
|
b0 = bisect_left(s, q2 - sdp) |
|
|
|
b4 = bisect_right(s, q2 + sdp) |
|
|
|
b4 = bisect_right(s, q2 + sdp) |
|
|
|
q0 = s[b0] |
|
|
|
q0 = s[b0] |
|
|
|
q4 = s[b4-1] |
|
|
|
q4 = s[b4 - 1] |
|
|
|
outliers = s[:b0] + s[b4:] |
|
|
|
outliers = s[:b0] + s[b4:] |
|
|
|
elif mode == '1.5IQR': |
|
|
|
elif mode == '1.5IQR': |
|
|
|
# 1.5IQR mode |
|
|
|
# 1.5IQR mode |
|
|
|