@@ -3635,33 +3635,23 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
3635
3635
if showfliers is None :
3636
3636
showfliers = rcParams ['boxplot.showfliers' ]
3637
3637
3638
- def _update_dict (dictionary , rc_name , properties ):
3639
- """ Loads properties in the dictionary from rc file if not already
3640
- in the dictionary"""
3641
- rc_str = 'boxplot.{0}.{1}'
3642
- if dictionary is None :
3643
- dictionary = dict ()
3644
- for prop_dict in properties :
3645
- dictionary .setdefault (prop_dict ,
3646
- rcParams [rc_str .format (rc_name , prop_dict )])
3647
- return dictionary
3648
-
3649
- # Common property dicts loading from rc.
3650
- flier_props = ['color' , 'marker' , 'markerfacecolor' , 'markeredgecolor' ,
3651
- 'markersize' , 'linestyle' , 'linewidth' ]
3652
- default_props = ['color' , 'linewidth' , 'linestyle' ]
3653
-
3654
- boxprops = _update_dict (boxprops , 'boxprops' , default_props )
3655
- whiskerprops = _update_dict (whiskerprops , 'whiskerprops' ,
3656
- default_props )
3657
- capprops = _update_dict (capprops , 'capprops' , default_props )
3658
- medianprops = _update_dict (medianprops , 'medianprops' , default_props )
3659
- meanprops = _update_dict (meanprops , 'meanprops' , default_props )
3660
- flierprops = _update_dict (flierprops , 'flierprops' , flier_props )
3638
+ if boxprops is None :
3639
+ boxprops = {}
3640
+ if whiskerprops is None :
3641
+ whiskerprops = {}
3642
+ if capprops is None :
3643
+ capprops = {}
3644
+ if medianprops is None :
3645
+ medianprops = {}
3646
+ if meanprops is None :
3647
+ meanprops = {}
3648
+ if flierprops is None :
3649
+ flierprops = {}
3661
3650
3662
3651
if patch_artist :
3663
- boxprops ['linestyle' ] = 'solid'
3664
- boxprops ['edgecolor' ] = boxprops .pop ('color' )
3652
+ boxprops ['linestyle' ] = 'solid' # Not consistent with bxp.
3653
+ if 'color' in boxprops :
3654
+ boxprops ['edgecolor' ] = boxprops .pop ('color' )
3665
3655
3666
3656
# if non-default sym value, put it into the flier dictionary
3667
3657
# the logic for providing the default symbol ('b+') now lives
@@ -3895,88 +3885,66 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=True,
3895
3885
3896
3886
zdelta = 0.1
3897
3887
# box properties
3888
+ final_boxprops = dict (
3889
+ linestyle = rcParams ['boxplot.boxprops.linestyle' ],
3890
+ linewidth = rcParams ['boxplot.boxprops.linewidth' ],
3891
+ )
3898
3892
if patch_artist :
3899
- final_boxprops = dict (
3900
- linestyle = rcParams ['boxplot.boxprops.linestyle' ],
3893
+ final_boxprops .update (
3901
3894
edgecolor = rcParams ['boxplot.boxprops.color' ],
3902
- facecolor = rcParams ['patch.facecolor' ],
3903
- linewidth = rcParams ['boxplot.boxprops.linewidth' ]
3895
+ facecolor = ( 'white' if rcParams ['_internal.classic_mode' ] else
3896
+ rcParams ['patch.facecolor' ]),
3904
3897
)
3905
- if rcParams ['_internal.classic_mode' ]:
3906
- final_boxprops ['facecolor' ] = 'white'
3907
3898
else :
3908
- final_boxprops = dict (
3909
- linestyle = rcParams ['boxplot.boxprops.linestyle' ],
3899
+ final_boxprops .update (
3910
3900
color = rcParams ['boxplot.boxprops.color' ],
3911
3901
)
3912
3902
3913
3903
final_boxprops ['zorder' ] = zorder
3914
3904
if boxprops is not None :
3915
3905
final_boxprops .update (boxprops )
3916
3906
3917
- # other (cap, whisker) properties
3918
- final_whiskerprops = dict (
3919
- linestyle = rcParams ['boxplot.whiskerprops.linestyle' ],
3920
- linewidth = rcParams ['boxplot.whiskerprops.linewidth' ],
3921
- color = rcParams ['boxplot.whiskerprops.color' ],
3922
- )
3923
-
3924
- final_capprops = dict (
3925
- linestyle = rcParams ['boxplot.capprops.linestyle' ],
3926
- linewidth = rcParams ['boxplot.capprops.linewidth' ],
3927
- color = rcParams ['boxplot.capprops.color' ],
3928
- )
3929
-
3930
- final_capprops ['zorder' ] = zorder
3931
- if capprops is not None :
3932
- final_capprops .update (capprops )
3933
-
3907
+ # whisker properties
3908
+ final_whiskerprops = {
3909
+ k .split ('.' )[- 1 ]: v for k , v in rcParams .items ()
3910
+ if k .startswith ('boxplot.whiskerprops' )
3911
+ }
3934
3912
final_whiskerprops ['zorder' ] = zorder
3935
3913
if whiskerprops is not None :
3936
3914
final_whiskerprops .update (whiskerprops )
3937
-
3938
- # set up the default flier properties
3939
- final_flierprops = dict (
3940
- linestyle = rcParams [ 'boxplot.flierprops.linestyle' ],
3941
- linewidth = rcParams [ 'boxplot.flierprops.linewidth' ],
3942
- color = rcParams [ 'boxplot.flierprops.color' ],
3943
- marker = rcParams [ 'boxplot.flierprops.marker' ],
3944
- markerfacecolor = rcParams [ 'boxplot.flierprops.markerfacecolor' ],
3945
- markeredgecolor = rcParams [ 'boxplot.flierprops.markeredgecolor' ],
3946
- markeredgewidth = rcParams [ 'boxplot.flierprops.markeredgewidth' ],
3947
- markersize = rcParams [ 'boxplot.flierprops.markersize' ],
3948
- )
3949
-
3915
+ # cap properties
3916
+ final_capprops = {
3917
+ k . split ( '.' )[ - 1 ]: v for k , v in rcParams . items ()
3918
+ if k . startswith ( 'boxplot.capprops' )
3919
+ }
3920
+ final_capprops [ 'zorder' ] = zorder
3921
+ if capprops is not None :
3922
+ final_capprops . update ( capprops )
3923
+ # flier properties
3924
+ final_flierprops = {
3925
+ k . split ( '.' )[ - 1 ]: v for k , v in rcParams . items ()
3926
+ if k . startswith ( 'boxplot.flierprops' )
3927
+ }
3950
3928
final_flierprops ['zorder' ] = zorder
3951
- # flier (outlier) properties
3952
3929
if flierprops is not None :
3953
3930
final_flierprops .update (flierprops )
3954
-
3955
3931
# median line properties
3956
- final_medianprops = dict (
3957
- linestyle = rcParams ['boxplot.medianprops.linestyle' ],
3958
- linewidth = rcParams ['boxplot.medianprops.linewidth' ],
3959
- color = rcParams ['boxplot.medianprops.color' ],
3960
- )
3932
+ final_medianprops = {
3933
+ k .split ('.' )[- 1 ]: v for k , v in rcParams .items ()
3934
+ if k .startswith ('boxplot.medianprops' )
3935
+ }
3961
3936
final_medianprops ['zorder' ] = zorder + zdelta
3962
3937
if medianprops is not None :
3963
3938
final_medianprops .update (medianprops )
3964
-
3965
3939
# mean (line or point) properties
3940
+ final_meanprops = {
3941
+ k .split ('.' )[- 1 ]: v for k , v in rcParams .items ()
3942
+ if k .startswith ('boxplot.meanprops' )
3943
+ }
3966
3944
if meanline :
3967
- final_meanprops = dict (
3968
- linestyle = rcParams ['boxplot.meanprops.linestyle' ],
3969
- linewidth = rcParams ['boxplot.meanprops.linewidth' ],
3970
- color = rcParams ['boxplot.meanprops.color' ],
3971
- )
3945
+ final_meanprops ['marker' ] = ''
3972
3946
else :
3973
- final_meanprops = dict (
3974
- linestyle = '' ,
3975
- marker = rcParams ['boxplot.meanprops.marker' ],
3976
- markerfacecolor = rcParams ['boxplot.meanprops.markerfacecolor' ],
3977
- markeredgecolor = rcParams ['boxplot.meanprops.markeredgecolor' ],
3978
- markersize = rcParams ['boxplot.meanprops.markersize' ],
3979
- )
3947
+ final_meanprops ['linestyle' ] = ''
3980
3948
final_meanprops ['zorder' ] = zorder + zdelta
3981
3949
if meanprops is not None :
3982
3950
final_meanprops .update (meanprops )
0 commit comments