MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_subfigure

Function test_subfigure

lib/matplotlib/tests/test_figure.py:1350–1375  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1348@image_comparison(['test_subfigure.png'], style='mpl20',
1349 savefig_kwarg={'facecolor': 'teal'})
1350def 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
1378def test_subfigure_tightbbox():

Callers

nothing calls this directly

Calls 10

figureMethod · 0.80
subfiguresMethod · 0.80
pcolormeshMethod · 0.80
suptitleMethod · 0.80
get_zorderMethod · 0.80
subplotsMethod · 0.45
colorbarMethod · 0.45
set_facecolorMethod · 0.45
legendMethod · 0.45
set_zorderMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…