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

Method test_parasite

lib/matplotlib/tests/test_legend.py:415–426  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

413 ax.legend((lnc, lns), labels=('a', 'b'))
414
415 def test_parasite(self):
416 from mpl_toolkits.axes_grid1 import host_subplot
417
418 host = host_subplot(111)
419 par = host.twinx()
420
421 p1, = host.plot([0, 1, 2], [0, 1, 2], label="Density")
422 p2, = par.plot([0, 1, 2], [0, 3, 2], label="Temperature")
423
424 with mock.patch('matplotlib.legend.Legend') as Legend:
425 plt.legend()
426 Legend.assert_called_with(host, [p1, p2], ['Density', 'Temperature'])
427
428 def test_legend_warns_on_unequal_number_of_handles_and_labels(self):
429 fig, ax = plt.subplots()

Callers

nothing calls this directly

Calls 3

twinxMethod · 0.45
plotMethod · 0.45
legendMethod · 0.45

Tested by

no test coverage detected