Skip to content

Commit eccfed2

Browse files
committed
Switch grid documentation to numpydoc style
1 parent e9feb7c commit eccfed2

File tree

2 files changed

+36
-22
lines changed

2 files changed

+36
-22
lines changed

lib/matplotlib/axes/_base.py

+20-15
Original file line numberDiff line numberDiff line change
@@ -2681,30 +2681,35 @@ def set_axisbelow(self, b):
26812681
@docstring.dedent_interpd
26822682
def grid(self, b=None, which='major', axis='both', **kwargs):
26832683
"""
2684-
Turn the axes grids on or off.
2684+
Configure the grid lines.
26852685
2686-
Set the axes grids on or off; *b* is a boolean.
2686+
Parameters
2687+
----------
2688+
b : bool or None
2689+
Whether to show the grid lines. If any *kwargs* are supplied,
2690+
it is assumed you want the grid on and *b* will be set to True.
26872691
2688-
If *b* is *None* and ``len(kwargs)==0``, toggle the grid state. If
2689-
*kwargs* are supplied, it is assumed that you want a grid and *b*
2690-
is thus set to *True*.
2692+
If *b* is *None* and there are no *kwargs*, this toggles the
2693+
visibility of the lines.
26912694
2692-
*which* can be 'major' (default), 'minor', or 'both' to control
2693-
whether major tick grids, minor tick grids, or both are affected.
2695+
which : {'major', 'minor', 'both'}
2696+
The grid lines to apply the changes on.
26942697
2695-
*axis* can be 'both' (default), 'x', or 'y' to control which
2696-
set of gridlines are drawn.
2698+
axis : {'both', 'x', 'y'}
2699+
The axis to apply the changes on.
26972700
2698-
*kwargs* are used to set the grid line properties, e.g.,::
2701+
**kwargs : `.Line2D` properties
2702+
Define the line properties of the grid, e.g.::
26992703
2700-
ax.grid(color='r', linestyle='-', linewidth=2)
2704+
grid(color='r', linestyle='-', linewidth=2)
27012705
2702-
Valid :class:`~matplotlib.lines.Line2D` kwargs are
2706+
Valid *kwargs* are
27032707
2704-
%(Line2D)s
2708+
%(Line2D)s
27052709
2706-
Note that the grid will be drawn according to the axes' zorder and not
2707-
its own.
2710+
Notes
2711+
-----
2712+
The grid will be drawn according to the axes' zorder and not its own.
27082713
"""
27092714
if len(kwargs):
27102715
b = True

lib/matplotlib/axis.py

+16-7
Original file line numberDiff line numberDiff line change
@@ -1417,16 +1417,25 @@ def get_minor_ticks(self, numticks=None):
14171417

14181418
def grid(self, b=None, which='major', **kwargs):
14191419
"""
1420-
Set the axis grid on or off; b is a boolean. Use *which* =
1421-
'major' | 'minor' | 'both' to set the grid for major or minor ticks.
1420+
Configure the grid lines.
14221421
1423-
If *b* is *None* and len(kwargs)==0, toggle the grid state. If
1424-
*kwargs* are supplied, it is assumed you want the grid on and *b*
1425-
will be set to True.
1422+
Parameters
1423+
----------
1424+
b : bool or None
1425+
Whether to show the grid lines. If any *kwargs* are supplied,
1426+
it is assumed you want the grid on and *b* will be set to True.
1427+
1428+
If *b* is *None* and there are no *kwargs*, this toggles the
1429+
visibility of the lines.
1430+
1431+
which : {'major', 'minor', 'both'}
1432+
The grid lines to apply the changes on.
1433+
1434+
**kwargs : `.Line2D` properties
1435+
Define the line properties of the grid, e.g.::
14261436
1427-
*kwargs* are used to set the line properties of the grids, e.g.,
1437+
grid(color='r', linestyle='-', linewidth=2)
14281438
1429-
xax.grid(color='r', linestyle='-', linewidth=2)
14301439
"""
14311440
if len(kwargs):
14321441
b = True

0 commit comments

Comments
 (0)