Check that the legend location with automatic placement is the same, whatever the histogram type is. Related to issue #9580.
()
| 88 | |
| 89 | |
| 90 | def test_legend_auto4(): |
| 91 | """ |
| 92 | Check that the legend location with automatic placement is the same, |
| 93 | whatever the histogram type is. Related to issue #9580. |
| 94 | """ |
| 95 | # NB: barstacked is pointless with a single dataset. |
| 96 | fig, axs = plt.subplots(ncols=3, figsize=(6.4, 2.4)) |
| 97 | leg_bboxes = [] |
| 98 | for ax, ht in zip(axs.flat, ('bar', 'step', 'stepfilled')): |
| 99 | ax.set_title(ht) |
| 100 | # A high bar on the left but an even higher one on the right. |
| 101 | ax.hist([0] + 5*[9], bins=range(10), label="Legend", histtype=ht) |
| 102 | leg = ax.legend(loc="best") |
| 103 | fig.canvas.draw() |
| 104 | leg_bboxes.append( |
| 105 | leg.get_window_extent().transformed(ax.transAxes.inverted())) |
| 106 | |
| 107 | # The histogram type "bar" is assumed to be the correct reference. |
| 108 | assert_allclose(leg_bboxes[1].bounds, leg_bboxes[0].bounds) |
| 109 | assert_allclose(leg_bboxes[2].bounds, leg_bboxes[0].bounds) |
| 110 | |
| 111 | |
| 112 | def test_legend_auto5(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…