Hello matplotlib folks!
I am trying to sketch out a complex figure, with multiple subfigures. However, I can’t seem to get the final figure PDF to come out the same size as I specify. Here is an MRE:
fig = plt.figure(constrained_layout=False, figsize=(7.5, 3.5))
subfigs = fig.subfigures(nrows=3, ncols=1, height_ratios=[1, 0.1, 1])
top_row = subfigs[0].subplots(nrows=1, ncols=3,
gridspec_kw={'width_ratios': [3, 2, 2],
})
mosaic = """
AFG
BFG
CFG
DFG
EFG
"""
bottom_row = subfigs[2].subplot_mosaic(mosaic,
gridspec_kw={'width_ratios': [5, 1, 2],
'height_ratios': [1, 0.1, 1, 0.2, 0.2],
})
plt.savefig('experimental.pdf', bbox_inches='tight')
The tricky thing is the bottom left subfigure, which has many plots with the same shared x axis. This also needs to be wider than the top row left subfigures.
Any help is much appreciated!