8000 DOC: explain zorder for gridlines in grid docstring by efiring · Pull Request #13995 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

DOC: explain zorder for gridlines in grid docstring #13995

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions lib/matplotlib/axes/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2701,8 +2701,9 @@ def set_axisbelow(self, b):
Possible values:

- *True* (zorder = 0.5): Ticks and gridlines are below all Artists.
- 'line' (zorder = 1.5): Ticks and gridlines are above patches (
e.g. rectangles) but still below lines / markers.
- 'line' (zorder = 1.5): Ticks and gridlines are above patches
(e.g. rectangles, with default zorder = 1) but still below lines
and markers (with their default zorder = 2).
- *False* (zorder = 2.5): Ticks and gridlines are above patches
and lines / markers.

Expand Down Expand Up @@ -2730,17 +2731,17 @@ def grid(self, b=None, which='major', axis='both', **kwargs):

Parameters
----------
b : bool or None
b : bool or None, optional
Whether to show the grid lines. If any *kwargs* are supplied,
it is assumed you want the grid on and *b* will be set to True.

If *b* is *None* and there are no *kwargs*, this toggles the
visibility of the lines.

which : {'major', 'minor', 'both'}
which : {'major', 'minor', 'both'}, optional
The grid lines to apply the changes on.

axis : {'both', 'x', 'y'}
axis : {'both', 'x', 'y'}, optional
The axis to apply the changes on.

**kwargs : `.Line2D` properties
Expand All @@ -2754,7 +2755,11 @@ def grid(self, b=None, which='major', axis='both', **kwargs):

Notes
-----
The grid will be drawn according to the axes' zorder and not its own.
The axis is drawn as a unit, so the effective zorder for drawing the
grid is determined by the zorder of each axis, not by the zorder of the
`.Line2D` objects comprising the grid. Therefore, to set grid zorder,
use `.set_axisbelow` or, for more control, call the
`~matplotlib.axis.Axis.set_zorder` method of each axis.
"""
if len(kwargs):
b = True
Expand Down
0