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

Function test_find_nearest_contour

lib/matplotlib/tests/test_contour.py:569–588  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

567
568
569def test_find_nearest_contour():
570 xy = np.indices((15, 15))
571 img = np.exp(-np.pi * (np.sum((xy - 5)**2, 0)/5.**2))
572 cs = plt.contour(img, 10)
573
574 nearest_contour = cs.find_nearest_contour(1, 1, pixel=False)
575 expected_nearest = (1, 0, 33, 1.965966, 1.965966, 1.866183)
576 assert_array_almost_equal(nearest_contour, expected_nearest)
577
578 nearest_contour = cs.find_nearest_contour(8, 1, pixel=False)
579 expected_nearest = (1, 0, 5, 7.550173, 1.587542, 0.547550)
580 assert_array_almost_equal(nearest_contour, expected_nearest)
581
582 nearest_contour = cs.find_nearest_contour(2, 5, pixel=False)
583 expected_nearest = (3, 0, 21, 1.884384, 5.023335, 0.013911)
584 assert_array_almost_equal(nearest_contour, expected_nearest)
585
586 nearest_contour = cs.find_nearest_contour(2, 5, indices=(5, 7), pixel=False)
587 expected_nearest = (5, 0, 16, 2.628202, 5.0, 0.394638)
588 assert_array_almost_equal(nearest_contour, expected_nearest)
589
590
591def test_find_nearest_contour_no_filled():

Callers

nothing calls this directly

Calls 2

find_nearest_contourMethod · 0.80
contourMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…