@@ -1957,18 +1957,21 @@ def set_axisbelow(self, b):
19571957 self ._axisbelow = b
19581958
19591959 @docstring .dedent_interpd
1960- def grid (self , b = None , ** kwargs ):
1960+ def grid (self , b = None , which = 'major' , ** kwargs ):
19611961 """
19621962 call signature::
19631963
1964- grid(self, b=None, **kwargs)
1964+ grid(self, b=None, which='major', **kwargs)
19651965
19661966 Set the axes grids on or off; *b* is a boolean. (For Matlab
19671967 compatibility, *b* may also be a string, 'on' or 'off'.)
19681968
19691969 If *b* is *None* and ``len(kwargs)==0``, toggle the grid state. If
19701970 *kwargs* are supplied, it is assumed that you want a grid and *b*
1971- is thus set to *True*
1971+ is thus set to *True*.
1972+
1973+ *which* can be 'major' (default), 'minor', or 'both' to control
1974+ whether major tick grids, minor tick grids, or both are affected.
19721975
19731976 *kawrgs* are used to set the grid line properties, eg::
19741977
@@ -1981,8 +1984,8 @@ def grid(self, b=None, **kwargs):
19811984 if len (kwargs ):
19821985 b = True
19831986 b = _string_to_bool (b )
1984- self .xaxis .grid (b , ** kwargs )
1985- self .yaxis .grid (b , ** kwargs )
1987+ self .xaxis .grid (b , which = which , ** kwargs )
1988+ self .yaxis .grid (b , which = which , ** kwargs )
19861989
19871990 def ticklabel_format (self , ** kwargs ):
19881991 """
0 commit comments