()
| 894 | |
| 895 | @image_comparison(['rotate_image'], remove_text=True, style='_classic_test') |
| 896 | def 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 | |
| 923 | def test_image_preserve_size(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…