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

Function test_contour_manual

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

Source from the content-addressed store, hash-verified

526@image_comparison(['contour_manual.png'], remove_text=True, style='_classic_test',
527 tol=0.89)
528def test_contour_manual():
529 # Manually specifying contour lines/polygons to plot.
530 from matplotlib.contour import ContourSet
531
532 fig, ax = plt.subplots(figsize=(4, 4))
533 cmap = 'viridis'
534
535 # Segments only (no 'kind' codes).
536 lines0 = [[[2, 0], [1, 2], [1, 3]]] # Single line.
537 lines1 = [[[3, 0], [3, 2]], [[3, 3], [3, 4]]] # Two lines.
538 filled01 = [[[0, 0], [0, 4], [1, 3], [1, 2], [2, 0]]]
539 filled12 = [[[2, 0], [3, 0], [3, 2], [1, 3], [1, 2]], # Two polygons.
540 [[1, 4], [3, 4], [3, 3]]]
541 ContourSet(ax, [0, 1, 2], [filled01, filled12], filled=True, cmap=cmap)
542 ContourSet(ax, [1, 2], [lines0, lines1], linewidths=3, colors=['r', 'k'])
543
544 # Segments and kind codes (1 = MOVETO, 2 = LINETO, 79 = CLOSEPOLY).
545 segs = [[[4, 0], [7, 0], [7, 3], [4, 3], [4, 0],
546 [5, 1], [5, 2], [6, 2], [6, 1], [5, 1]]]
547 kinds = [[1, 2, 2, 2, 79, 1, 2, 2, 2, 79]] # Polygon containing hole.
548 ContourSet(ax, [2, 3], [segs], [kinds], filled=True, cmap=cmap)
549 ContourSet(ax, [2], [segs], [kinds], colors='k', linewidths=3)
550
551
552@image_comparison(['contour_line_start_on_corner_edge.png'], remove_text=True,

Callers

nothing calls this directly

Calls 2

ContourSetClass · 0.90
subplotsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…