Skip to content

Commit efffe26

Browse files
committed
add image test for the 3 axisbelow options
1 parent 9366510 commit efffe26

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed
Loading

lib/matplotlib/tests/test_axes.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from matplotlib.testing.noseclasses import KnownFailureTest
2626
import matplotlib.pyplot as plt
2727
import matplotlib.markers as mmarkers
28+
import matplotlib.patches as mpatches
2829
from numpy.testing import assert_allclose, assert_array_equal
2930
import warnings
3031
from matplotlib.cbook import IgnoredKeywordWarning
@@ -4417,6 +4418,27 @@ def test_date_timezone_x_and_y():
44174418
plt.plot_date(time_index, time_index, tz='US/Eastern', ydate=True)
44184419

44194420

4421+
@image_comparison(baseline_images=['axisbelow'],
4422+
extensions=['png'], remove_text=True)
4423+
def test_axisbelow():
4424+
# Test 'line' setting added in 6287.
4425+
# Show only grids, not frame or ticks, to make this test
4426+
# independent of future change to drawing order of those elements.
4427+
fig, axs = plt.subplots(ncols=3, sharex=True, sharey=True)
4428+
settings = (False, 'line', True)
4429+
4430+
for ax, setting in zip(axs, settings):
4431+
ax.plot((0, 10), (0, 10), lw=10, color='m')
4432+
circ = mpatches.Circle((3, 3), color='r')
4433+
ax.add_patch(circ)
4434+
ax.grid(color='c', linestyle='-', linewidth=3)
4435+
ax.tick_params(top=False, bottom=False,
4436+
left=False, right=False)
4437+
for spine in ax.spines.values():
4438+
spine.set_visible(False)
4439+
ax.set_axisbelow(setting)
4440+
4441+
44204442
if __name__ == '__main__':
44214443
import nose
44224444
import sys

0 commit comments

Comments
 (0)