MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_pcolormesh

Function test_pcolormesh

lib/matplotlib/tests/test_axes.py:1424–1444  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1422@image_comparison(['pcolormesh'], remove_text=True, style='_classic_test',
1423 tol=0.11 if platform.machine() == 'aarch64' else 0)
1424def test_pcolormesh():
1425 # Remove this line when this test image is regenerated.
1426 plt.rcParams['pcolormesh.snap'] = False
1427
1428 n = 12
1429 x = np.linspace(-1.5, 1.5, n)
1430 y = np.linspace(-1.5, 1.5, n*2)
1431 X, Y = np.meshgrid(x, y)
1432 Qx = np.cos(Y) - np.cos(X)
1433 Qz = np.sin(Y) + np.sin(X)
1434 Qx = (Qx + 1.1)
1435 Z = np.hypot(X, Y) / 5
1436 Z = (Z - Z.min()) / np.ptp(Z)
1437
1438 # The color array can include masked values:
1439 Zm = ma.masked_where(np.abs(Qz) < 0.5 * np.max(Qz), Z)
1440
1441 _, (ax1, ax2, ax3) = plt.subplots(1, 3)
1442 ax1.pcolormesh(Qx, Qz, Zm[:-1, :-1], lw=0.5, edgecolors='k')
1443 ax2.pcolormesh(Qx, Qz, Zm[:-1, :-1], lw=2, edgecolors=['b', 'w'])
1444 ax3.pcolormesh(Qx, Qz, Zm, shading="gouraud")
1445
1446
1447@image_comparison(['pcolormesh_small.eps'], style='_classic_test')

Callers

nothing calls this directly

Calls 4

minMethod · 0.80
maxMethod · 0.80
pcolormeshMethod · 0.80
subplotsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…