()
| 636 | |
| 637 | |
| 638 | def 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( |
nothing calls this directly
no test coverage detected
searching dependent graphs…