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

Function test_spy_box

lib/matplotlib/tests/test_image.py:1424–1453  ·  view source on GitHub ↗
(fig_test, fig_ref)

Source from the content-addressed store, hash-verified

1422
1423@check_figures_equal()
1424def test_spy_box(fig_test, fig_ref):
1425 # setting up reference and test
1426 ax_test = fig_test.subplots(1, 3)
1427 ax_ref = fig_ref.subplots(1, 3)
1428
1429 plot_data = (
1430 [[1, 1], [1, 1]],
1431 [[0, 0], [0, 0]],
1432 [[0, 1], [1, 0]],
1433 )
1434 plot_titles = ["ones", "zeros", "mixed"]
1435
1436 for i, (z, title) in enumerate(zip(plot_data, plot_titles)):
1437 ax_test[i].set_title(title)
1438 ax_test[i].spy(z)
1439 ax_ref[i].set_title(title)
1440 ax_ref[i].imshow(z, interpolation='nearest',
1441 aspect='equal', origin='upper', cmap='Greys',
1442 vmin=0, vmax=1)
1443 ax_ref[i].set_xlim(-0.5, 1.5)
1444 ax_ref[i].set_ylim(1.5, -0.5)
1445 ax_ref[i].xaxis.tick_top()
1446 ax_ref[i].title.set_y(1.05)
1447 ax_ref[i].xaxis.set_ticks_position('both')
1448 ax_ref[i].xaxis.set_major_locator(
1449 mticker.MaxNLocator(nbins=9, steps=[1, 2, 5, 10], integer=True)
1450 )
1451 ax_ref[i].yaxis.set_major_locator(
1452 mticker.MaxNLocator(nbins=9, steps=[1, 2, 5, 10], integer=True)
1453 )
1454
1455
1456@image_comparison(["nonuniform_and_pcolor.png"], style="mpl20")

Callers

nothing calls this directly

Calls 10

spyMethod · 0.80
imshowMethod · 0.80
tick_topMethod · 0.80
subplotsMethod · 0.45
set_titleMethod · 0.45
set_xlimMethod · 0.45
set_ylimMethod · 0.45
set_yMethod · 0.45
set_ticks_positionMethod · 0.45
set_major_locatorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…