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

Function test_legend_expand

lib/matplotlib/tests/test_legend.py:247–259  ·  view source on GitHub ↗

Test expand mode

()

Source from the content-addressed store, hash-verified

245
246@image_comparison(['legend_expand.png'], remove_text=True, style='mpl20')
247def test_legend_expand():
248 """Test expand mode"""
249 legend_modes = [None, "expand"]
250 fig, axs = plt.subplots(len(legend_modes), 1)
251 x = np.arange(100)
252 for ax, mode in zip(axs, legend_modes):
253 ax.plot(x, 50 - x, 'o', label='y=1')
254 l1 = ax.legend(loc='upper left', mode=mode)
255 ax.add_artist(l1)
256 ax.plot(x, x - 50, 'o', label='y=-1')
257 l2 = ax.legend(loc='right', mode=mode)
258 ax.add_artist(l2)
259 ax.legend(loc='lower left', mode=mode, ncols=2)
260
261
262@image_comparison(['hatching'], remove_text=True, style='default')

Callers

nothing calls this directly

Calls 4

subplotsMethod · 0.45
plotMethod · 0.45
legendMethod · 0.45
add_artistMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…