I use a GridSpec within matplotlib to trying to generate the following plot:
However I fail at adding the titles at the desired positions, which are at the top center of each two columns. The following code creates the plot above sans titles:
fig = plt.figure(constrained_layout=True)
gs = fig.add_gridspec(2, 6)
for i in range(0, 6, 2):
fig.add_subplot(gs[:, i])
fig.add_subplot(gs[0, i + 1])
fig.add_subplot(gs[1, i + 1])
Adding the following two lines creates the titles but also creates a figure above the other figures:
title = fig.add_subplot(gs[:, i:i + 2])
title.set_title(f'title #{i}')
How do I have to change the given code to get the desired result depicted above? Is there a way to hide the new figures? Is there a way to set titles/text without figures?
