|
36 | 36 | from matplotlib.artist import allow_rasterization
|
37 | 37 |
|
38 | 38 | from matplotlib.rcsetup import cycler
|
| 39 | +from matplotlib.rcsetup import validate_axisbelow |
39 | 40 |
|
40 | 41 | rcParams = matplotlib.rcParams
|
41 | 42 |
|
@@ -441,8 +442,9 @@ def __init__(self, fig, rect,
|
441 | 442 | *aspect* [ 'auto' | 'equal' | aspect_ratio ]
|
442 | 443 | *autoscale_on* [ *True* | *False* ] whether or not to
|
443 | 444 | autoscale the *viewlim*
|
444 |
| - *axisbelow* draw the grids and ticks below the other |
445 |
| - artists |
| 445 | + *axisbelow* [ *True* | *False* | 'line'] draw the grids |
| 446 | + and ticks below or above most other artists, |
| 447 | + or below lines but above patches |
446 | 448 | *cursor_props* a (*float*, *color*) tuple
|
447 | 449 | *figure* a :class:`~matplotlib.figure.Figure`
|
448 | 450 | instance
|
@@ -2308,12 +2310,16 @@ def draw(self, renderer=None, inframe=False):
|
2308 | 2310 | artists.remove(spine)
|
2309 | 2311 |
|
2310 | 2312 | if self.axison and not inframe:
|
2311 |
| - if self._axisbelow: |
| 2313 | + if self._axisbelow == True: |
2312 | 2314 | self.xaxis.set_zorder(0.5)
|
2313 | 2315 | self.yaxis.set_zorder(0.5)
|
2314 |
| - else: |
| 2316 | + elif self._axisbelow == False: |
2315 | 2317 | self.xaxis.set_zorder(2.5)
|
2316 | 2318 | self.yaxis.set_zorder(2.5)
|
| 2319 | + else: |
| 2320 | + # above patches, below lines |
| 2321 | + self.xaxis.set_zorder(1.5) |
| 2322 | + self.yaxis.set_zorder(1.5) |
2317 | 2323 | else:
|
2318 | 2324 | for _axis in self._get_axis_list():
|
2319 | 2325 | artists.remove(_axis)
|
@@ -2413,9 +2419,9 @@ def set_axisbelow(self, b):
|
2413 | 2419 | Set whether the axis ticks and gridlines are above or below most
|
2414 | 2420 | artists
|
2415 | 2421 |
|
2416 |
| - ACCEPTS: [ *True* | *False* ] |
| 2422 | + ACCEPTS: [ *True* | *False* | 'line' ] |
2417 | 2423 | """
|
2418 |
| - self._axisbelow = b |
| 2424 | + self._axisbelow = validate_axisbelow(b) |
2419 | 2425 | self.stale = True
|
2420 | 2426 |
|
2421 | 2427 | @docstring.dedent_interpd
|
|
0 commit comments