(fig_test, fig_ref)
| 1374 | |
| 1375 | @check_figures_equal() |
| 1376 | def test_norm_change(fig_test, fig_ref): |
| 1377 | # LogNorm should not mask anything invalid permanently. |
| 1378 | data = np.full((5, 5), 1, dtype=np.float64) |
| 1379 | data[0:2, :] = -1 |
| 1380 | |
| 1381 | masked_data = np.ma.array(data, mask=False) |
| 1382 | masked_data.mask[0:2, 0:2] = True |
| 1383 | |
| 1384 | cmap = mpl.colormaps['viridis'].with_extremes(under='w') |
| 1385 | |
| 1386 | ax = fig_test.subplots() |
| 1387 | im = ax.imshow(data, norm=colors.LogNorm(vmin=0.5, vmax=1), |
| 1388 | extent=(0, 5, 0, 5), interpolation='nearest', cmap=cmap) |
| 1389 | im.set_norm(colors.Normalize(vmin=-2, vmax=2)) |
| 1390 | im = ax.imshow(masked_data, norm=colors.LogNorm(vmin=0.5, vmax=1), |
| 1391 | extent=(5, 10, 5, 10), interpolation='nearest', cmap=cmap) |
| 1392 | im.set_norm(colors.Normalize(vmin=-2, vmax=2)) |
| 1393 | ax.set(xlim=(0, 10), ylim=(0, 10)) |
| 1394 | |
| 1395 | ax = fig_ref.subplots() |
| 1396 | ax.imshow(data, norm=colors.Normalize(vmin=-2, vmax=2), |
| 1397 | extent=(0, 5, 0, 5), interpolation='nearest', cmap=cmap) |
| 1398 | ax.imshow(masked_data, norm=colors.Normalize(vmin=-2, vmax=2), |
| 1399 | extent=(5, 10, 5, 10), interpolation='nearest', cmap=cmap) |
| 1400 | ax.set(xlim=(0, 10), ylim=(0, 10)) |
| 1401 | |
| 1402 | |
| 1403 | @pytest.mark.parametrize('x', [-1, 1]) |
nothing calls this directly
no test coverage detected
searching dependent graphs…