@@ -168,11 +168,8 @@ def set_title(self, label, fontdict=None, loc=None, pad=None, *, y=None,
168168            Other keyword arguments are text properties, see `.Text` for a list 
169169            of valid text properties. 
170170        """ 
171-         if  loc  is  None :
172-             loc  =  mpl .rcParams ['axes.titlelocation' ]
173- 
174-         if  y  is  None :
175-             y  =  mpl .rcParams ['axes.titley' ]
171+         loc  =  mpl ._val_or_rc (loc , 'axes.titlelocation' ).lower ()
172+         y  =  mpl ._val_or_rc (y , 'axes.titley' )
176173        if  y  is  None :
177174            y  =  1.0 
178175        else :
@@ -182,18 +179,16 @@ def set_title(self, label, fontdict=None, loc=None, pad=None, *, y=None,
182179        titles  =  {'left' : self ._left_title ,
183180                  'center' : self .title ,
184181                  'right' : self ._right_title }
185-         title  =  _api .check_getitem (titles , loc = loc . lower () )
182+         title  =  _api .check_getitem (titles , loc = loc )
186183        default  =  {
187184            'fontsize' : mpl .rcParams ['axes.titlesize' ],
188185            'fontweight' : mpl .rcParams ['axes.titleweight' ],
189186            'verticalalignment' : 'baseline' ,
190-             'horizontalalignment' : loc . lower () }
187+             'horizontalalignment' : loc }
191188        titlecolor  =  mpl .rcParams ['axes.titlecolor' ]
192189        if  not  cbook ._str_lower_equal (titlecolor , 'auto' ):
193190            default ["color" ] =  titlecolor 
194-         if  pad  is  None :
195-             pad  =  mpl .rcParams ['axes.titlepad' ]
196-         self ._set_title_offset_trans (float (pad ))
191+         self ._set_title_offset_trans (float (mpl ._val_or_rc (pad , 'axes.titlepad' )))
197192        title .set_text (label )
198193        title .update (default )
199194        if  fontdict  is  not None :
@@ -3160,8 +3155,7 @@ def stem(self, *args, linefmt=None, markerfmt=None, basefmt=None, bottom=0,
31603155            markerfmt  =  "o" 
31613156        if  markerfmt  ==  '' :
31623157            markerfmt  =  ' '   # = empty line style; '' would resolve rcParams 
3163-         markerstyle , markermarker , markercolor  =  \
3164-             _process_plot_format (markerfmt )
3158+         markerstyle , markermarker , markercolor  =  _process_plot_format (markerfmt )
31653159        if  markermarker  is  None :
31663160            markermarker  =  'o' 
31673161        if  markerstyle  is  None :
@@ -3176,8 +3170,7 @@ def stem(self, *args, linefmt=None, markerfmt=None, basefmt=None, bottom=0,
31763170        basestyle , basemarker , basecolor  =  _process_plot_format (basefmt )
31773171
31783172        # New behaviour in 3.1 is to use a LineCollection for the stemlines 
3179-         if  linestyle  is  None :
3180-             linestyle  =  mpl .rcParams ['lines.linestyle' ]
3173+         linestyle  =  mpl ._val_or_rc (linestyle , 'lines.linestyle' )
31813174        xlines  =  self .vlines  if  orientation  ==  "vertical"  else  self .hlines 
31823175        stemlines  =  xlines (
31833176            locs , bottom , heads ,
@@ -3745,8 +3738,7 @@ def _upcast_err(err):
37453738
37463739        # Make the style dict for caps (the "hats"). 
37473740        eb_cap_style  =  {** base_style , 'linestyle' : 'none' }
3748-         if  capsize  is  None :
3749-             capsize  =  mpl .rcParams ["errorbar.capsize" ]
3741+         capsize  =  mpl ._val_or_rc (capsize , "errorbar.capsize" )
37503742        if  capsize  >  0 :
37513743            eb_cap_style ['markersize' ] =  2.  *  capsize 
37523744        if  capthick  is  not None :
@@ -4100,27 +4092,18 @@ def boxplot(self, x, notch=None, sym=None, vert=None,
41004092        """ 
41014093
41024094        # Missing arguments default to rcParams. 
4103-         if  whis  is  None :
4104-             whis  =  mpl .rcParams ['boxplot.whiskers' ]
4105-         if  bootstrap  is  None :
4106-             bootstrap  =  mpl .rcParams ['boxplot.bootstrap' ]
4095+         whis  =  mpl ._val_or_rc (whis , 'boxplot.whiskers' )
4096+         bootstrap  =  mpl ._val_or_rc (bootstrap , 'boxplot.bootstrap' )
41074097
41084098        bxpstats  =  cbook .boxplot_stats (x , whis = whis , bootstrap = bootstrap ,
41094099                                       labels = tick_labels , autorange = autorange )
4110-         if  notch  is  None :
4111-             notch  =  mpl .rcParams ['boxplot.notch' ]
4112-         if  patch_artist  is  None :
4113-             patch_artist  =  mpl .rcParams ['boxplot.patchartist' ]
4114-         if  meanline  is  None :
4115-             meanline  =  mpl .rcParams ['boxplot.meanline' ]
4116-         if  showmeans  is  None :
4117-             showmeans  =  mpl .rcParams ['boxplot.showmeans' ]
4118-         if  showcaps  is  None :
4119-             showcaps  =  mpl .rcParams ['boxplot.showcaps' ]
4120-         if  showbox  is  None :
4121-             showbox  =  mpl .rcParams ['boxplot.showbox' ]
4122-         if  showfliers  is  None :
4123-             showfliers  =  mpl .rcParams ['boxplot.showfliers' ]
4100+         notch  =  mpl ._val_or_rc (notch , 'boxplot.notch' )
4101+         patch_artist  =  mpl ._val_or_rc (patch_artist , 'boxplot.patchartist' )
4102+         meanline  =  mpl ._val_or_rc (meanline , 'boxplot.meanline' )
4103+         showmeans  =  mpl ._val_or_rc (showmeans , 'boxplot.showmeans' )
4104+         showcaps  =  mpl ._val_or_rc (showcaps , 'boxplot.showcaps' )
4105+         showbox  =  mpl ._val_or_rc (showbox , 'boxplot.showbox' )
4106+         showfliers  =  mpl ._val_or_rc (showfliers , 'boxplot.showfliers' )
41244107
41254108        if  boxprops  is  None :
41264109            boxprops  =  {}
@@ -4931,8 +4914,7 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
49314914        scales  =  s    # Renamed for readability below. 
49324915
49334916        # load default marker from rcParams 
4934-         if  marker  is  None :
4935-             marker  =  mpl .rcParams ['scatter.marker' ]
4917+         marker  =  mpl ._val_or_rc (marker , 'scatter.marker' )
49364918
49374919        if  isinstance (marker , mmarkers .MarkerStyle ):
49384920            marker_obj  =  marker 
@@ -6478,9 +6460,7 @@ def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
64786460        `~.Axes.pcolormesh`, which is not available with `~.Axes.pcolor`. 
64796461
64806462        """ 
6481-         if  shading  is  None :
6482-             shading  =  mpl .rcParams ['pcolor.shading' ]
6483-         shading  =  shading .lower ()
6463+         shading  =  mpl ._val_or_rc (shading , 'pcolor.shading' ).lower ()
64846464        kwargs .setdefault ('edgecolors' , 'none' )
64856465
64866466        X , Y , C , shading  =  self ._pcolorargs ('pcolormesh' , * args ,
@@ -6985,8 +6965,7 @@ def hist(self, x, bins=None, range=None, density=False, weights=None,
69856965        if  np .isscalar (x ):
69866966            x  =  [x ]
69876967
6988-         if  bins  is  None :
6989-             bins  =  mpl .rcParams ['hist.bins' ]
6968+         bins  =  mpl ._val_or_rc (bins , 'hist.bins' )
69906969
69916970        # Validate string inputs here to avoid cluttering subsequent code. 
69926971        _api .check_in_list (['bar' , 'barstacked' , 'step' , 'stepfilled' ],
0 commit comments