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

Function test_norm_change

lib/matplotlib/tests/test_image.py:1376–1400  ·  view source on GitHub ↗
(fig_test, fig_ref)

Source from the content-addressed store, hash-verified

1374
1375@check_figures_equal()
1376def 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])

Callers

nothing calls this directly

Calls 5

imshowMethod · 0.80
with_extremesMethod · 0.45
subplotsMethod · 0.45
set_normMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…