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

Function test_legend_auto2

lib/matplotlib/tests/test_legend.py:69–75  ·  view source on GitHub ↗

Test automatic legend placement

()

Source from the content-addressed store, hash-verified

67
68@image_comparison(['legend_auto2.png'], remove_text=True, style='mpl20')
69def test_legend_auto2():
70 """Test automatic legend placement"""
71 fig, ax = plt.subplots()
72 x = np.arange(100)
73 b1 = ax.bar(x, x, align='edge', color='m')
74 b2 = ax.bar(x, x[::-1], align='edge', color='g')
75 ax.legend([b1[0], b2[0]], ['up', 'down'], loc='best')
76
77
78@image_comparison(['legend_auto3.png'], style='mpl20')

Callers

nothing calls this directly

Calls 3

subplotsMethod · 0.45
barMethod · 0.45
legendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…