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

Function test_nn_pixel_alignment

lib/matplotlib/tests/test_image.py:1891–1910  ·  view source on GitHub ↗
(nonaffine_identity)

Source from the content-addressed store, hash-verified

1889
1890@image_comparison(['nn_pixel_alignment.png'], style='_classic_test')
1891def 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')

Callers

nothing calls this directly

Calls 5

imshowMethod · 0.80
vlinesMethod · 0.80
hlinesMethod · 0.80
subplotsMethod · 0.45
set_axis_offMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…