Can someone help me create a layout for plots with the following structure:
A CD
A/B EF
B GH
where A,B are 3D plots (fig.add_subplot(241, projection='3d')) and C,D,E,F,G,H are regular 2D plots. A/B represents a shared space where half of plot A and half of plot B appear.
You could use a subplot_mosaic:
f, grid = plt.subplot_mosaic('''\
ACD
ACD
AEF
BEF
BGH
BGH''', per_subplot_kw={('A', 'B'): {'projection': '3d'}} )
plt.tight_layout()
Then plot on grid['A']/grid['B']/grid['C']/...
Output:
If you need a more flexible, play with the gridspec:
f, grid = plt.subplot_mosaic('''\
ACD
ACD
AEF
BEF
BGH
BGH''', per_subplot_kw={('A', 'B'): {'projection': '3d'}},
gridspec_kw={'width_ratios':[3, 1, 1],
'height_ratios':[3, 1, 1, 1, 1, 1],
})
plt.tight_layout()
Output: