(nonaffine_identity)
| 1970 | |
| 1971 | @image_comparison(['image_bounds_handling.png'], style='_classic_test', tol=0.006) |
| 1972 | def test_image_bounds_handling(nonaffine_identity): |
| 1973 | # TODO: The second and third panels in the bottom row show that the handling of |
| 1974 | # image bounds is bugged for non-affine transforms and non-nearest-neighbor |
| 1975 | # interpolation. If this bug gets fixed, the baseline image should be updated. |
| 1976 | |
| 1977 | fig, axs = plt.subplots(2, 3) |
| 1978 | |
| 1979 | N = 11 |
| 1980 | |
| 1981 | for j, interpolation in enumerate(['nearest', 'hanning', 'bilinear']): |
| 1982 | data = np.arange(N**2).reshape((N, N)) |
| 1983 | data = data / N**2 + (data % 4) / 6 |
| 1984 | rotation = Affine2D().rotate_around(N/2-0.5, N/2-0.5, 1) |
| 1985 | |
| 1986 | for i in range(2): |
| 1987 | transform = rotation + axs[i, j].transData |
| 1988 | if i == 1: |
| 1989 | # Bottom row uses a non-affine transform |
| 1990 | transform = nonaffine_identity + transform |
| 1991 | |
| 1992 | axs[i, j].imshow(data, cmap='Grays', interpolation=interpolation, |
| 1993 | transform=transform) |
| 1994 | |
| 1995 | axs[i, j].set_axis_off() |
| 1996 | box = Rectangle((-0.5, -0.5), N, N, |
| 1997 | edgecolor='red', facecolor='none', lw=0.5, ls='dashed', |
| 1998 | transform=rotation + axs[i, j].transData) |
| 1999 | axs[i, j].add_artist(box) |
| 2000 | |
| 2001 | |
| 2002 | @image_comparison(['rgba_clean_edges.png'], style='_classic_test', tol=0.003) |
nothing calls this directly
no test coverage detected
searching dependent graphs…