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

Function test_contour_legend_elements

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

Source from the content-addressed store, hash-verified

636
637
638def test_contour_legend_elements():
639 x = np.arange(1, 10)
640 y = x.reshape(-1, 1)
641 h = x * y
642
643 colors = ['blue', '#00FF00', 'red']
644 cs = plt.contour(h, levels=[10, 30, 50],
645 colors=colors,
646 extend='both')
647 artists, labels = cs.legend_elements()
648 assert labels == ['$x = 10.0$', '$x = 30.0$', '$x = 50.0$']
649 assert all(isinstance(a, mpl.lines.Line2D) for a in artists)
650 assert all(same_color(a.get_color(), c)
651 for a, c in zip(artists, colors))
652
653
654@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 4

same_colorFunction · 0.90
contourMethod · 0.45
legend_elementsMethod · 0.45
get_colorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…