()
| 1596 | |
| 1597 | |
| 1598 | def test_legend_loc_polycollection(): |
| 1599 | # Test that the legend is placed in the correct |
| 1600 | # position for 'best' for polycollection |
| 1601 | x = [3, 4, 5] |
| 1602 | y1 = [1, 1, 1] |
| 1603 | y2 = [5, 5, 5] |
| 1604 | leg_bboxes = [] |
| 1605 | fig, axs = plt.subplots(ncols=2, figsize=(10, 5)) |
| 1606 | for ax, loc in zip(axs.flat, ('best', 'lower left')): |
| 1607 | ax.fill_between(x, y1, y2, color='gray', alpha=0.5, label='Shaded Area') |
| 1608 | ax.set_xlim(0, 6) |
| 1609 | ax.set_ylim(-1, 5) |
| 1610 | leg = ax.legend(loc=loc) |
| 1611 | fig.canvas.draw() |
| 1612 | leg_bboxes.append( |
| 1613 | leg.get_window_extent().transformed(ax.transAxes.inverted())) |
| 1614 | assert_allclose(leg_bboxes[1].bounds, leg_bboxes[0].bounds) |
| 1615 | |
| 1616 | |
| 1617 | def test_legend_text(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…