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

Function test_rotate_image

lib/matplotlib/tests/test_image.py:896–920  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

894
895@image_comparison(['rotate_image'], remove_text=True, style='_classic_test')
896def test_rotate_image():
897 delta = 0.25
898 x = y = np.arange(-3.0, 3.0, delta)
899 X, Y = np.meshgrid(x, y)
900 Z1 = np.exp(-(X**2 + Y**2) / 2) / (2 * np.pi)
901 Z2 = (np.exp(-(((X - 1) / 1.5)**2 + ((Y - 1) / 0.5)**2) / 2) /
902 (2 * np.pi * 0.5 * 1.5))
903 Z = Z2 - Z1 # difference of Gaussians
904
905 fig, ax1 = plt.subplots(1, 1)
906 im1 = ax1.imshow(Z, interpolation='none', cmap='viridis',
907 origin='lower',
908 extent=[-2, 4, -3, 2], clip_on=True)
909
910 trans_data2 = Affine2D().rotate_deg(30) + ax1.transData
911 im1.set_transform(trans_data2)
912
913 # display intended extent of the image
914 x1, x2, y1, y2 = im1.get_extent()
915
916 ax1.plot([x1, x2, x2, x1, x1], [y1, y1, y2, y2, y1], "r--", lw=3,
917 transform=trans_data2)
918
919 ax1.set_xlim(2, 5)
920 ax1.set_ylim(0, 4)
921
922
923def test_image_preserve_size():

Callers

nothing calls this directly

Calls 9

Affine2DClass · 0.90
imshowMethod · 0.80
rotate_degMethod · 0.80
subplotsMethod · 0.45
set_transformMethod · 0.45
get_extentMethod · 0.45
plotMethod · 0.45
set_xlimMethod · 0.45
set_ylimMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…