()
| 1615 | |
| 1616 | |
| 1617 | def test_legend_text(): |
| 1618 | # Test that legend is place in the correct |
| 1619 | # position for 'best' when there is text in figure |
| 1620 | fig, axs = plt.subplots(ncols=2, figsize=(10, 5)) |
| 1621 | leg_bboxes = [] |
| 1622 | for ax, loc in zip(axs.flat, ('best', 'lower left')): |
| 1623 | x = [1, 2] |
| 1624 | y = [2, 1] |
| 1625 | ax.plot(x, y, label='plot name') |
| 1626 | ax.text(1.5, 2, 'some text blahblah', verticalalignment='top') |
| 1627 | leg = ax.legend(loc=loc) |
| 1628 | fig.canvas.draw() |
| 1629 | leg_bboxes.append( |
| 1630 | leg.get_window_extent().transformed(ax.transAxes.inverted())) |
| 1631 | assert_allclose(leg_bboxes[1].bounds, leg_bboxes[0].bounds) |
| 1632 | |
| 1633 | |
| 1634 | def test_legend_annotate(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…