()
| 26 | |
| 27 | |
| 28 | def test_legend_ordereddict(): |
| 29 | # smoketest that ordereddict inputs work... |
| 30 | |
| 31 | X = np.random.randn(10) |
| 32 | Y = np.random.randn(10) |
| 33 | labels = ['a'] * 5 + ['b'] * 5 |
| 34 | colors = ['r'] * 5 + ['g'] * 5 |
| 35 | |
| 36 | fig, ax = plt.subplots() |
| 37 | for x, y, label, color in zip(X, Y, labels, colors): |
| 38 | ax.scatter(x, y, label=label, c=color) |
| 39 | |
| 40 | handles, labels = ax.get_legend_handles_labels() |
| 41 | legend = collections.OrderedDict(zip(labels, handles)) |
| 42 | ax.legend(legend.values(), legend.keys(), |
| 43 | loc='center left', bbox_to_anchor=(1, .5)) |
| 44 | |
| 45 | |
| 46 | def test_legend_generator(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…