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

Function test_tricontour_path

lib/matplotlib/tests/test_triangulation.py:1347–1370  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1345
1346
1347def test_tricontour_path():
1348 x = [0, 4, 4, 0, 2]
1349 y = [0, 0, 4, 4, 2]
1350 triang = mtri.Triangulation(x, y)
1351 _, ax = plt.subplots()
1352
1353 # Line strip from boundary to boundary
1354 cs = ax.tricontour(triang, [1, 0, 0, 0, 0], levels=[0.5])
1355 paths = cs.get_paths()
1356 assert len(paths) == 1
1357 expected_vertices = [[2, 0], [1, 1], [0, 2]]
1358 assert_array_almost_equal(paths[0].vertices, expected_vertices)
1359 assert_array_equal(paths[0].codes, [1, 2, 2])
1360 assert_array_almost_equal(
1361 paths[0].to_polygons(closed_only=False), [expected_vertices])
1362
1363 # Closed line loop inside domain
1364 cs = ax.tricontour(triang, [0, 0, 0, 0, 1], levels=[0.5])
1365 paths = cs.get_paths()
1366 assert len(paths) == 1
1367 expected_vertices = [[3, 1], [3, 3], [1, 3], [1, 1], [3, 1]]
1368 assert_array_almost_equal(paths[0].vertices, expected_vertices)
1369 assert_array_equal(paths[0].codes, [1, 2, 2, 2, 79])
1370 assert_array_almost_equal(paths[0].to_polygons(), [expected_vertices])
1371
1372
1373def test_tricontourf_path():

Callers

nothing calls this directly

Calls 4

tricontourMethod · 0.80
to_polygonsMethod · 0.80
subplotsMethod · 0.45
get_pathsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…