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

Function test_imshow_clip

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

Source from the content-addressed store, hash-verified

1236@image_comparison(['imshow_clip'], style='mpl20',
1237 tol=0 if platform.machine() == 'x86_64' else 1.24)
1238def test_imshow_clip():
1239 # As originally reported by Gellule Xg <gellule.xg@free.fr>
1240 # use former defaults to match existing baseline image
1241 matplotlib.rcParams['image.interpolation'] = 'nearest'
1242
1243 # Create an NxN image
1244 N = 100
1245 (x, y) = np.indices((N, N))
1246 x -= N//2
1247 y -= N//2
1248 r = np.sqrt(x**2+y**2-x*y)
1249
1250 # Create a contour plot at N/4 and extract both the clip path and transform
1251 fig, ax = plt.subplots()
1252
1253 c = ax.contour(r, [N/4])
1254 clip_path = mtransforms.TransformedPath(c.get_paths()[0], c.get_transform())
1255
1256 # Plot the image clipped by the contour
1257 ax.imshow(r, clip_path=clip_path)
1258
1259
1260def test_imshow_norm_vminvmax():

Callers

nothing calls this directly

Calls 6

sqrtMethod · 0.80
imshowMethod · 0.80
subplotsMethod · 0.45
contourMethod · 0.45
get_pathsMethod · 0.45
get_transformMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…