(nonaffine_identity)
| 1889 | |
| 1890 | @image_comparison(['nn_pixel_alignment.png'], style='_classic_test') |
| 1891 | def test_nn_pixel_alignment(nonaffine_identity): |
| 1892 | fig, axs = plt.subplots(2, 3) |
| 1893 | |
| 1894 | for j, N in enumerate([3, 7, 11]): |
| 1895 | # In each column, the plots use the same data array |
| 1896 | data = np.arange(N**2).reshape((N, N)) % 4 |
| 1897 | seps = np.arange(-0.5, N) |
| 1898 | |
| 1899 | for i in range(2): |
| 1900 | if i == 0: |
| 1901 | # Top row uses an affine transform |
| 1902 | axs[i, j].imshow(data, cmap='Grays', interpolation='nearest') |
| 1903 | else: |
| 1904 | # Bottom row uses a non-affine transform |
| 1905 | axs[i, j].imshow(data, cmap='Grays', interpolation='nearest', |
| 1906 | transform=nonaffine_identity + axs[i, j].transData) |
| 1907 | |
| 1908 | axs[i, j].set_axis_off() |
| 1909 | axs[i, j].vlines(seps, -1, N, lw=0.5, color='red', ls='dashed') |
| 1910 | axs[i, j].hlines(seps, -1, N, lw=0.5, color='red', ls='dashed') |
| 1911 | |
| 1912 | |
| 1913 | @image_comparison(['alignment_half_display_pixels.png'], style='mpl20') |
nothing calls this directly
no test coverage detected
searching dependent graphs…