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

Function test_legend_ordereddict

lib/matplotlib/tests/test_legend.py:28–43  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26
27
28def 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
46def test_legend_generator():

Callers

nothing calls this directly

Calls 5

valuesMethod · 0.80
subplotsMethod · 0.45
scatterMethod · 0.45
legendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…