()
| 1461 | |
| 1462 | |
| 1463 | def test_subfigure_spanning(): |
| 1464 | # test that subfigures get laid out properly... |
| 1465 | fig = plt.figure(constrained_layout=True) |
| 1466 | gs = fig.add_gridspec(3, 3) |
| 1467 | sub_figs = [ |
| 1468 | fig.add_subfigure(gs[0, 0]), |
| 1469 | fig.add_subfigure(gs[0:2, 1]), |
| 1470 | fig.add_subfigure(gs[2, 1:3]), |
| 1471 | fig.add_subfigure(gs[0:, 1:]) |
| 1472 | ] |
| 1473 | |
| 1474 | w = 640 |
| 1475 | h = 480 |
| 1476 | np.testing.assert_allclose(sub_figs[0].bbox.min, [0., h * 2/3]) |
| 1477 | np.testing.assert_allclose(sub_figs[0].bbox.max, [w / 3, h]) |
| 1478 | |
| 1479 | np.testing.assert_allclose(sub_figs[1].bbox.min, [w / 3, h / 3]) |
| 1480 | np.testing.assert_allclose(sub_figs[1].bbox.max, [w * 2/3, h]) |
| 1481 | |
| 1482 | np.testing.assert_allclose(sub_figs[2].bbox.min, [w / 3, 0]) |
| 1483 | np.testing.assert_allclose(sub_figs[2].bbox.max, [w, h / 3]) |
| 1484 | |
| 1485 | # check here that slicing actually works. Last sub_fig |
| 1486 | # with open slices failed, but only on draw... |
| 1487 | for i in range(4): |
| 1488 | sub_figs[i].add_subplot() |
| 1489 | fig.draw_without_rendering() |
| 1490 | |
| 1491 | |
| 1492 | @mpl.style.context('mpl20') |
nothing calls this directly
no test coverage detected
searching dependent graphs…