@@ -2883,18 +2883,19 @@ def boxplot(self, x, notch=False, sym='b+', vert=True, whis=1.5,
2883
2883
meanline = False , showmeans = False , showcaps = True ,
2884
2884
showbox = True , showfliers = True , boxprops = None , labels = None ,
2885
2885
flierprops = None , medianprops = None , meanprops = None ,
2886
- manage_xticks = True ):
2886
+ capprops = None , whiskerprops = None , manage_xticks = True ):
2887
2887
"""
2888
2888
Make a box and whisker plot.
2889
2889
2890
2890
Call signature::
2891
2891
2892
- boxplot(x, notch=False, sym='b+', vert=True, whis=1.5,
2892
+ boxplot(self, x, notch=False, sym='b+', vert=True, whis=1.5,
2893
2893
positions=None, widths=None, patch_artist=False,
2894
2894
bootstrap=None, usermedians=None, conf_intervals=None,
2895
2895
meanline=False, showmeans=False, showcaps=True,
2896
2896
showbox=True, showfliers=True, boxprops=None, labels=None,
2897
- flierprops=None, medianprops=None, meanprops=None)
2897
+ flierprops=None, medianprops=None, meanprops=None,
2898
+ capprops=None, whiskerprops=None, manage_xticks=True):
2898
2899
2899
2900
Make a box and whisker plot for each column of *x* or each
2900
2901
vector in sequence *x*. The box extends from the lower to
@@ -2914,7 +2915,7 @@ def boxplot(self, x, notch=False, sym='b+', vert=True, whis=1.5,
2914
2915
2915
2916
sym : str, default = 'b+'
2916
2917
The default symbol for flier points.
2917
- Enter an empty string ('') if you don't want to show fliers.
2918
+ Enter an empty string ('') if you don't wantshow fliers.
2918
2919
2919
2920
vert : bool, default = False
2920
2921
If True (default), makes the boxes vertical.
@@ -2947,13 +2948,13 @@ def boxplot(self, x, notch=False, sym='b+', vert=True, whis=1.5,
2947
2948
An array or sequence whose first dimension (or length) is
2948
2949
compatible with *x*. This overrides the medians computed by
2949
2950
matplotlib for each element of *usermedians* that is not None.
2950
- When an element of *usermedians* == None, the median will be
2951
- computed by matplotlib as normal.
2951
+ When an element of *usermedians* == None, the median will be
2952
+ cted by matplb as normal.
2952
2953
2953
2954
conf_intervals : array-like or None (default)
2954
2955
Array or sequence whose first dimension (or length) is compatible
2955
2956
with *x* and whose second dimension is 2. When the current element
2956
- of *conf_intervals * is not None, the notch locations computed by
2957
+ ofnf_intervals * is not None, the notch locations computed by
2957
2958
matplotlib are overridden (assuming notch is True). When an
2958
2959
element of *conf_intervals* is None, boxplot compute notches the
2959
2960
method specified by the other kwargs (e.g., *bootstrap*).
@@ -2990,6 +2991,12 @@ def boxplot(self, x, notch=False, sym='b+', vert=True, whis=1.5,
2990
2991
boxprops : dict or None (default)
2991
2992
If provided, will set the plotting style of the boxes
2992
2993
2994
+ whiskerprops : dict or None (default)
2995
+ If provided, will set the plotting style of the whiskers
2996
+
2997
+ capprops : dict or None (default)
2998
+ If provided, will set the plotting style of the whiskers
2999
+
2993
3000
flierprops : dict or None (default)
2994
3001
If provided, will set the plotting style of the fliers
2995
3002
@@ -3030,9 +3037,10 @@ def boxplot(self, x, notch=False, sym='b+', vert=True, whis=1.5,
3030
3037
"""
3031
3038
bxpstats = cbook .boxplot_stats (x , whis = whis , bootstrap = bootstrap ,
3032
3039
labels = labels )
3033
- if sym == 'b+' and flierprops is None :
3034
- flierprops = dict (linestyle = 'none' , marker = '+' ,
3035
- markeredgecolor = 'blue' )
3040
+ if flierprops is None :
3041
+ flierprops = dict (sym = sym )
3042
+ else :
3043
+ flierprops ['sym' ] = sym
3036
3044
3037
3045
# replace medians if necessary:
3038
3046
if usermedians is not None :
@@ -3069,24 +3077,27 @@ def boxplot(self, x, notch=False, sym='b+', vert=True, whis=1.5,
3069
3077
boxprops = boxprops , flierprops = flierprops ,
3070
3078
medianprops = medianprops , meanprops = meanprops ,
3071
3079
meanline = meanline , showfliers = showfliers ,
3080
+ capprops = capprops , whiskerprops = whiskerprops ,
3072
3081
manage_xticks = manage_xticks )
3073
3082
return artists
3074
3083
3075
3084
def bxp (self , bxpstats , positions = None , widths = None , vert = True ,
3076
3085
patch_artist = False , shownotches = False , showmeans = False ,
3077
3086
showcaps = True , showbox = True , showfliers = True ,
3078
- boxprops = None , flierprops = None , medianprops = None ,
3079
- meanprops = None , meanline = False , manage_xticks = True ):
3087
+ boxprops = None , whiskerprops = None , flierprops = None ,
3088
+ medianprops = None , capprops = None , meanprops = None ,
3089
+ meanline = False , manage_xticks = True ):
3080
3090
"""
3081
3091
Drawing function for box and whisker plots.
3082
3092
3083
3093
Call signature::
3084
3094
3085
- bxp(bxpstats, positions=None, widths=None, vert=True,
3095
+ bxp(self, bxpstats, positions=None, widths=None, vert=True,
3086
3096
patch_artist=False, shownotches=False, showmeans=False,
3087
3097
showcaps=True, showbox=True, showfliers=True,
3088
- boxprops=None, flierprops=None, medianprops=None,
3089
- meanprops=None, meanline=False, manage_xticks=True)
3098
+ boxprops=None, whiskerprops=None, flierprops=None,
3099
+ medianprops=None, capprops=None, meanprops=None,
3100
+ meanline=False, manage_xticks=True):
3090
3101
3091
3102
Make a box and whisker plot for each column of *x* or each
3092
3103
vector in sequence *x*. The box extends from the lower to
@@ -3132,14 +3143,14 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=True,
3132
3143
If True produces boxes with the Patch artist
3133
3144
3134
3145
shownotches : bool, default = False
3135
- If False (default), produces a rectangular box plot.
3136
- If True, will produce a notched box plot
3146
+ If False (default), produces a rectangular box plot.
3147
+ If True, will produce a ed box plot
3137
3148
3138
3149
showmeans : bool, default = False
3139
3150
If True, will toggle one the rendering of the means
3140
3151
3141
3152
showcaps : bool, default = True
3142
- If True, will toggle one the rendering of the caps
3153
+ If T will toggle one the rendering of the caps
3143
3154
3144
3155
showbox : bool, default = True
3145
3156
If True, will toggle one the rendering of box
@@ -3150,8 +3161,14 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=True,
3150
3161
boxprops : dict or None (default)
3151
3162
If provided, will set the plotting style of the boxes
3152
3163
3164
+ whiskerprops : dict or None (default)
3165
+ If provided, will set the plotting style of the whiskers
3166
+
3167
+ capprops : dict or None (default)
3168
+ If provided, will set the plotting style of the whiskers
3169
+
3153
3170
flierprops : dict or None (default)
3154
- If provided, will set the plotting style of the fliers
3171
+ If provi will set the plotting style of the fliers
3155
3172
3156
3173
medianprops : dict or None (default)
3157
3174
If provided, will set the plotting style of the medians
@@ -3215,37 +3232,52 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=True,
3215
3232
final_boxprops = dict (linestyle = 'solid' , edgecolor = 'black' ,
3216
3233
facecolor = 'white' , linewidth = 1 )
3217
3234
else :
3218
- final_boxprops = dict (linestyle = '-' , color = 'black' , linewidth = 1 )
3235
+ final_boxprops = dict (linestyle = '-' , color = 'blue' )
3219
3236
3220
3237
if boxprops is not None :
3221
3238
final_boxprops .update (boxprops )
3222
3239
3223
3240
# other (cap, whisker) properties
3224
- if patch_artist :
3225
- otherprops = dict (
3226
- linestyle = linestyle_map [final_boxprops ['linestyle' ]],
3227
- color = final_boxprops ['edgecolor' ],
3228
- linewidth = final_boxprops .get ('linewidth' , 1 )
3229
- )
3230
- else :
3231
- otherprops = dict (linestyle = final_boxprops ['linestyle' ],
3232
- color = final_boxprops ['color' ],
3233
- linewidth = final_boxprops .get ('linewidth' , 1 ))
3241
+ final_whiskerprops = dict (
3242
+ linestyle = '--' ,
3243
+ color = 'blue' ,
3244
+ )
3245
+
3246
+ final_capprops = dict (
3247
+ linestyle = '-' ,
3248
+ color = 'black' ,
3249
+ )
3250
+
3251
+ if capprops is not None :
3252
+ final_capprops .update (capprops )
3253
+
3254
+ if whiskerprops is not None :
3255
+ final_whiskerprops .update (whiskerprops )
3234
3256
3235
3257
# flier (outlier) properties
3236
- final_flierprops = dict (linestyle = 'none' , marker = '+' ,
3237
- markeredgecolor = 'blue' )
3238
3258
if flierprops is not None :
3259
+ sym = flierprops .pop ('sym' , '' )
3260
+
3261
+ if sym == '' :
3262
+ final_flierprops = dict (linestyle = 'none' , marker = '+' ,
3263
+ markeredgecolor = 'b' ,
3264
+ markerfacecolor = 'none' )
3265
+ else :
3266
+ final_flierprops = dict (linestyle = 'none' )
3239
3267
final_flierprops .update (flierprops )
3268
+ else :
3269
+ sym = ''
3270
+ final_flierprops = dict (linestyle = 'none' , marker = '+' ,
3271
+ markeredgecolor = 'b' )
3240
3272
3241
3273
# median line properties
3242
- final_medianprops = dict (linestyle = '-' , color = 'blue ' )
3274
+ final_medianprops = dict (linestyle = '-' , color = 'red ' )
3243
3275
if medianprops is not None :
3244
3276
final_medianprops .update (medianprops )
3245
3277
3246
3278
# mean (line or point) properties
3247
3279
if meanline :
3248
- final_meanprops = dict (linestyle = '--' , color = 'red ' )
3280
+ final_meanprops = dict (linestyle = '--' , color = 'black ' )
3249
3281
else :
3250
3282
final_meanprops = dict (linestyle = 'none' , markerfacecolor = 'red' ,
3251
3283
marker = 's' )
@@ -3365,13 +3397,17 @@ def dopatch(xs, ys, **kwargs):
3365
3397
boxes .extend (doplot (box_x , box_y , ** final_boxprops ))
3366
3398
3367
3399
# draw the whiskers
3368
- whiskers .extend (doplot (whisker_x , whiskerlo_y , ** otherprops ))
3369
- whiskers .extend (doplot (whisker_x , whiskerhi_y , ** otherprops ))
3400
+ whiskers .extend (doplot (
3401
+ whisker_x , whiskerlo_y ,** final_whiskerprops
3402
+ ))
3403
+ whiskers .extend (doplot (
3404
+ whisker_x , whiskerhi_y ,** final_whiskerprops
3405
+ ))
3370
3406
3371
3407
# maybe draw the caps:
3372
3408
if showcaps :
3373
- caps .extend (doplot (cap_x , cap_lo , ** otherprops ))
3374
- caps .extend (doplot (cap_x , cap_hi , ** otherprops ))
3409
+ caps .extend (doplot (cap_x , cap_lo , ** final_capprops ))
3410
+ caps .extend (doplot (cap_x , cap_hi , ** final_capprops ))
3375
3411
3376
3412
# draw the medians
3377
3413
medians .extend (doplot (med_x , med_y , ** final_medianprops ))
@@ -3390,7 +3426,9 @@ def dopatch(xs, ys, **kwargs):
3390
3426
3391
3427
# maybe draw the fliers
3392
3428
if showfliers :
3393
- fliers .extend (doplot (flier_x , flier_y , ** final_flierprops ))
3429
+ fliers .extend (doplot (
3430
+ flier_x , flier_y , sym , ** final_flierprops
3431
+ ))
3394
3432
3395
3433
# fix our axes/ticks up a little
3396
3434
if vert :
0 commit comments