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

Function test_subfigure_double

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

Source from the content-addressed store, hash-verified

1422@image_comparison(['test_subfigure_double.png'], style='mpl20',
1423 savefig_kwarg={'facecolor': 'teal'})
1424def test_subfigure_double():
1425 # test assigning the subfigure via subplotspec
1426 np.random.seed(19680801)
1427
1428 fig = plt.figure(layout='constrained', figsize=(10, 8))
1429
1430 fig.suptitle('fig')
1431
1432 subfigs = fig.subfigures(1, 2, wspace=0.07)
1433
1434 subfigs[0].set_facecolor('coral')
1435 subfigs[0].suptitle('subfigs[0]')
1436
1437 subfigs[1].set_facecolor('coral')
1438 subfigs[1].suptitle('subfigs[1]')
1439
1440 subfigsnest = subfigs[0].subfigures(2, 1, height_ratios=[1, 1.4])
1441 subfigsnest[0].suptitle('subfigsnest[0]')
1442 subfigsnest[0].set_facecolor('r')
1443 axsnest0 = subfigsnest[0].subplots(1, 2, sharey=True)
1444 for ax in axsnest0:
1445 fontsize = 12
1446 pc = ax.pcolormesh(np.random.randn(30, 30), vmin=-2.5, vmax=2.5)
1447 ax.set_xlabel('x-label', fontsize=fontsize)
1448 ax.set_ylabel('y-label', fontsize=fontsize)
1449 ax.set_title('Title', fontsize=fontsize)
1450 subfigsnest[0].colorbar(pc, ax=axsnest0)
1451
1452 subfigsnest[1].suptitle('subfigsnest[1]')
1453 subfigsnest[1].set_facecolor('g')
1454 axsnest1 = subfigsnest[1].subplots(3, 1, sharex=True)
1455 for nn, ax in enumerate(axsnest1):
1456 ax.set_ylabel(f'ylabel{nn}')
1457 subfigsnest[1].supxlabel('supxlabel')
1458 subfigsnest[1].supylabel('supylabel')
1459
1460 axsRight = subfigs[1].subplots(2, 2)
1461
1462
1463def test_subfigure_spanning():

Callers

nothing calls this directly

Calls 12

figureMethod · 0.80
suptitleMethod · 0.80
subfiguresMethod · 0.80
pcolormeshMethod · 0.80
set_xlabelMethod · 0.80
set_ylabelMethod · 0.80
supxlabelMethod · 0.80
supylabelMethod · 0.80
set_facecolorMethod · 0.45
subplotsMethod · 0.45
set_titleMethod · 0.45
colorbarMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…