@@ -1398,17 +1398,18 @@ def get_minor_ticks(self, numticks=None):
13981398
13991399 return self .minorTicks [:numticks ]
14001400
1401- def grid (self , b = None , which = 'major' , ** kwargs ):
1401+ @_api .rename_parameter ("3.5" , "b" , "visible" )
1402+ def grid (self , visible = None , which = 'major' , ** kwargs ):
14021403 """
14031404 Configure the grid lines.
14041405
14051406 Parameters
14061407 ----------
1407- b : bool or None
1408- Whether to show the grid lines. If any *kwargs* are supplied,
1409- it is assumed you want the grid on and *b * will be set to True.
1408+ visible : bool or None
1409+ Whether to show the grid lines. If any *kwargs* are supplied, it
1410+ is assumed you want the grid on and *visible * will be set to True.
14101411
1411- If *b * is *None* and there are no *kwargs*, this toggles the
1412+ If *visible * is *None* and there are no *kwargs*, this toggles the
14121413 visibility of the lines.
14131414
14141415 which : {'major', 'minor', 'both'}
@@ -1419,40 +1420,24 @@ def grid(self, b=None, which='major', **kwargs):
14191420
14201421 grid(color='r', linestyle='-', linewidth=2)
14211422 """
1422- TOGGLE = object ()
1423- UNSET = object ()
1424- visible = kwargs .pop ('visible' , UNSET )
1425-
1426- if b is None :
1427- if visible is UNSET :
1428- if kwargs : # grid(color='r')
1429- b = True
1430- else : # grid()
1431- b = TOGGLE
1432- else : # grid(visible=v)
1433- b = visible
1434- else :
1435- if visible is not UNSET and bool (b ) != bool (visible ):
1436- # grid(True, visible=False), grid(False, visible=True)
1437- raise ValueError (
1438- "'b' and 'visible' specify inconsistent grid visibilities" )
1439- if kwargs and not b : # something false-like but not None
1440- # grid(0, visible=True)
1423+ if kwargs :
1424+ if visible is None :
1425+ visible = True
1426+ elif not visible : # something false-like but not None
14411427 _api .warn_external ('First parameter to grid() is false, '
14421428 'but line properties are supplied. The '
14431429 'grid will be enabled.' )
1444- b = True
1445-
1430+ visible = True
14461431 which = which .lower ()
14471432 _api .check_in_list (['major' , 'minor' , 'both' ], which = which )
14481433 gridkw = {'grid_' + item [0 ]: item [1 ] for item in kwargs .items ()}
14491434 if which in ['minor' , 'both' ]:
14501435 gridkw ['gridOn' ] = (not self ._minor_tick_kw ['gridOn' ]
1451- if b is TOGGLE else b )
1436+ if visible is None else visible )
14521437 self .set_tick_params (which = 'minor' , ** gridkw )
14531438 if which in ['major' , 'both' ]:
14541439 gridkw ['gridOn' ] = (not self ._major_tick_kw ['gridOn' ]
1455- if b is TOGGLE else b )
1440+ if visible is None else visible )
14561441 self .set_tick_params (which = 'major' , ** gridkw )
14571442 self .stale = True
14581443
0 commit comments