I'm trying to create a figure with some supblots. Each of the subplots has also 2 subplots side by side. For that I've used the snippet described here (https://stackoverflow.com/a/67694491).
fig = plt.figure(constrained_layout=True)
subfigs = fig.subfigures(2, 2)
for outerind, subfig in enumerate(subfigs.flat):
subfig.suptitle(f'Subfig {outerind}')
axs = subfig.subplots(1, 2)
for innerind, ax in enumerate(axs.flat):
ax.set_title(f'outer={outerind}, inner={innerind}', fontsize='small')
ax.set_xticks([])
ax.set_yticks([])
ax.set_aspect(1 / ax.get_data_ratio())
plt.show()
The problems is that my subplots have to be squared, and if I resize the whole figure, the gaps between them and the title increases.
fig = plt.figure(constrained_layout=True,figsize=(10,10))
subfigs = fig.subfigures(2, 2)
for outerind, subfig in enumerate(subfigs.flat):
subfig.suptitle(f'Subfig {outerind}')
axs = subfig.subplots(1, 2)
for innerind, ax in enumerate(axs.flat):
ax.set_title(f'outer={outerind}, inner={innerind}', fontsize='small')
ax.set_xticks([])
ax.set_yticks([])
ax.set_aspect(1 / ax.get_data_ratio())
plt.show()
So, how can I keep the aspect I want but with a greater size?