@@ -24,7 +24,7 @@ def adjacent_values(vals, q1, q3):
24
24
25
25
lower_adjacent_value = q1 - (q3 - q1 ) * 1.5
26
26
lower_adjacent_value = np .clip (lower_adjacent_value , vals [0 ], q1 )
27
- return [ lower_adjacent_value , upper_adjacent_value ]
27
+ return lower_adjacent_value , upper_adjacent_value
28
28
29
29
30
30
def set_axis_style (ax , labels ):
@@ -60,13 +60,11 @@ def set_axis_style(ax, labels):
60
60
pc .set_alpha (1 )
61
61
62
62
quartile1 , medians , quartile3 = np .percentile (data , [25 , 50 , 75 ], axis = 1 )
63
- inter_quartile_ranges = np .vstack ([quartile1 , quartile3 ]).T
64
- whiskers = [
63
+ whiskers = np .array ([
65
64
adjacent_values (sorted_array , q1 , q3 )
66
- for sorted_array , q1 , q3 in zip (data , quartile1 , quartile3 )]
67
- whiskersMin , whiskersMax = list (zip (* whiskers ))
68
- # plot medians as points,
69
- # whiskers as thin lines, quartiles as fat lines
65
+ for sorted_array , q1 , q3 in zip (data , quartile1 , quartile3 )])
66
+ whiskersMin , whiskersMax = whiskers [:, 0 ], whiskers [:, 1 ]
67
+
70
68
inds = np .arange (1 , len (medians ) + 1 )
71
69
ax2 .scatter (inds , medians , marker = 'o' , color = 'white' , s = 30 , zorder = 3 )
72
70
ax2 .vlines (inds , quartile1 , quartile3 , color = 'k' , linestyle = '-' , lw = 5 )
0 commit comments