MCPcopy
hub / github.com/matplotlib/matplotlib / test_spy

Function test_spy

lib/matplotlib/tests/test_axes.py:202–220  ·  view source on GitHub ↗
(fig_test, fig_ref)

Source from the content-addressed store, hash-verified

200
201@check_figures_equal()
202def test_spy(fig_test, fig_ref):
203 np.random.seed(19680801)
204 a = np.ones(32 * 32)
205 a[:16 * 32] = 0
206 np.random.shuffle(a)
207 a = a.reshape((32, 32))
208
209 axs_test = fig_test.subplots(2)
210 axs_test[0].spy(a)
211 axs_test[1].spy(a, marker=".", origin="lower")
212
213 axs_ref = fig_ref.subplots(2)
214 axs_ref[0].imshow(a, cmap="gray_r", interpolation="nearest")
215 axs_ref[0].xaxis.tick_top()
216 axs_ref[1].plot(*np.nonzero(a)[::-1], ".", markersize=10)
217 axs_ref[1].set(
218 aspect=1, xlim=axs_ref[0].get_xlim(), ylim=axs_ref[0].get_ylim()[::-1])
219 for ax in axs_ref:
220 ax.xaxis.set_ticks_position("both")
221
222
223def test_spy_invalid_kwargs():

Callers

nothing calls this directly

Calls 9

spyMethod · 0.80
imshowMethod · 0.80
tick_topMethod · 0.80
subplotsMethod · 0.45
plotMethod · 0.45
setMethod · 0.45
get_xlimMethod · 0.45
get_ylimMethod · 0.45
set_ticks_positionMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…