Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9474ee6

Browse files
committed
TST: add a test
1 parent 33cfa96 commit 9474ee6

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,22 @@ def test_pcolornearest(fig_test, fig_ref):
12011201
ax.pcolormesh(x2, y2, Z, shading='nearest')
12021202

12031203

1204+
@check_figures_equal(extensions=["png"])
1205+
def test_pcolornearestunits(fig_test, fig_ref):
1206+
ax = fig_test.subplots()
1207+
x = [datetime.datetime.fromtimestamp(x * 3600) for x in range(10)]
1208+
y = np.arange(0, 3)
1209+
np.random.seed(19680801)
1210+
Z = np.random.randn(2, 9)
1211+
ax.pcolormesh(x, y, Z, shading='flat')
1212+
1213+
ax = fig_ref.subplots()
1214+
# specify the centers
1215+
x2 = [datetime.datetime.fromtimestamp((x + 0.5) * 3600) for x in range(9)]
1216+
y2 = y[:-1] + np.diff(y) / 2
1217+
ax.pcolormesh(x2, y2, Z, shading='nearest')
1218+
1219+
12041220
@check_figures_equal(extensions=["png"])
12051221
def test_pcolordropdata(fig_test, fig_ref):
12061222
ax = fig_test.subplots()

0 commit comments

Comments
 (0)