@@ -3635,33 +3635,23 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
36353635 if showfliers is None :
36363636 showfliers = rcParams ['boxplot.showfliers' ]
36373637
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 = {}
36613650
36623651 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' )
36653655
36663656 # if non-default sym value, put it into the flier dictionary
36673657 # the logic for providing the default symbol ('b+') now lives
@@ -3895,88 +3885,66 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=True,
38953885
38963886 zdelta = 0.1
38973887 # box properties
3888+ final_boxprops = dict (
3889+ linestyle = rcParams ['boxplot.boxprops.linestyle' ],
3890+ linewidth = rcParams ['boxplot.boxprops.linewidth' ],
3891+ )
38983892 if patch_artist :
3899- final_boxprops = dict (
3900- linestyle = rcParams ['boxplot.boxprops.linestyle' ],
3893+ final_boxprops .update (
39013894 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' ]),
39043897 )
3905- if rcParams ['_internal.classic_mode' ]:
3906- final_boxprops ['facecolor' ] = 'white'
39073898 else :
3908- final_boxprops = dict (
3909- linestyle = rcParams ['boxplot.boxprops.linestyle' ],
3899+ final_boxprops .update (
39103900 color = rcParams ['boxplot.boxprops.color' ],
39113901 )
39123902
39133903 final_boxprops ['zorder' ] = zorder
39143904 if boxprops is not None :
39153905 final_boxprops .update (boxprops )
39163906
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+ }
39343912 final_whiskerprops ['zorder' ] = zorder
39353913 if whiskerprops is not None :
39363914 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+ }
39503928 final_flierprops ['zorder' ] = zorder
3951- # flier (outlier) properties
39523929 if flierprops is not None :
39533930 final_flierprops .update (flierprops )
3954-
39553931 # 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+ }
39613936 final_medianprops ['zorder' ] = zorder + zdelta
39623937 if medianprops is not None :
39633938 final_medianprops .update (medianprops )
3964-
39653939 # 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+ }
39663944 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' ] = ''
39723946 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' ] = ''
39803948 final_meanprops ['zorder' ] = zorder + zdelta
39813949 if meanprops is not None :
39823950 final_meanprops .update (meanprops )
0 commit comments