()
| 1446 | |
| 1447 | @image_comparison(['pcolormesh_small.eps'], style='_classic_test') |
| 1448 | def test_pcolormesh_small(): |
| 1449 | n = 3 |
| 1450 | x = np.linspace(-1.5, 1.5, n) |
| 1451 | y = np.linspace(-1.5, 1.5, n*2) |
| 1452 | X, Y = np.meshgrid(x, y) |
| 1453 | Qx = np.cos(Y) - np.cos(X) |
| 1454 | Qz = np.sin(Y) + np.sin(X) |
| 1455 | Qx = (Qx + 1.1) |
| 1456 | Z = np.hypot(X, Y) / 5 |
| 1457 | Z = (Z - Z.min()) / np.ptp(Z) |
| 1458 | Zm = ma.masked_where(np.abs(Qz) < 0.5 * np.max(Qz), Z) |
| 1459 | Zm2 = ma.masked_where(Qz < -0.5 * np.max(Qz), Z) |
| 1460 | |
| 1461 | fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2) |
| 1462 | ax1.pcolormesh(Qx, Qz, Zm[:-1, :-1], lw=0.5, edgecolors='k') |
| 1463 | ax2.pcolormesh(Qx, Qz, Zm[:-1, :-1], lw=2, edgecolors=['b', 'w']) |
| 1464 | # gouraud with Zm yields a blank plot; there are no unmasked triangles. |
| 1465 | ax3.pcolormesh(Qx, Qz, Zm, shading="gouraud") |
| 1466 | # Reduce the masking to get a plot. |
| 1467 | ax4.pcolormesh(Qx, Qz, Zm2, shading="gouraud") |
| 1468 | |
| 1469 | for ax in fig.axes: |
| 1470 | ax.set_axis_off() |
| 1471 | |
| 1472 | |
| 1473 | @image_comparison(['pcolormesh_alpha'], extensions=["png", "pdf"], remove_text=True, |
nothing calls this directly
no test coverage detected
searching dependent graphs…