()
| 1348 | @image_comparison(['test_subfigure.png'], style='mpl20', |
| 1349 | savefig_kwarg={'facecolor': 'teal'}) |
| 1350 | def test_subfigure(): |
| 1351 | np.random.seed(19680801) |
| 1352 | fig = plt.figure(layout='constrained') |
| 1353 | sub = fig.subfigures(1, 2) |
| 1354 | |
| 1355 | axs = sub[0].subplots(2, 2) |
| 1356 | for ax in axs.flat: |
| 1357 | pc = ax.pcolormesh(np.random.randn(30, 30), vmin=-2, vmax=2) |
| 1358 | sub[0].colorbar(pc, ax=axs) |
| 1359 | sub[0].suptitle('Left Side') |
| 1360 | sub[0].set_facecolor('white') |
| 1361 | |
| 1362 | axs = sub[1].subplots(1, 3) |
| 1363 | for ax in axs.flat: |
| 1364 | pc = ax.pcolormesh(np.random.randn(30, 30), vmin=-2, vmax=2) |
| 1365 | sub[1].colorbar(pc, ax=axs, location='bottom') |
| 1366 | sub[1].suptitle('Right Side') |
| 1367 | sub[1].set_facecolor('white') |
| 1368 | |
| 1369 | fig.suptitle('Figure suptitle', fontsize='xx-large') |
| 1370 | |
| 1371 | # below tests for the draw zorder of subfigures. |
| 1372 | leg = fig.legend(handles=[plt.Line2D([0], [0], label='Line{}'.format(i)) |
| 1373 | for i in range(5)], loc='center') |
| 1374 | sub[0].set_zorder(leg.get_zorder() - 1) |
| 1375 | sub[1].set_zorder(leg.get_zorder() + 1) |
| 1376 | |
| 1377 | |
| 1378 | def test_subfigure_tightbbox(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…