I would like to plot a composite figure over two rows with one entry on the top row and two on the bottom row, with each subplot having the same aspect ratio. How can this be done?
Asked
Active
Viewed 450 times
-2
-
This is possible with `matplotlib`, but could you upload a sketch of what you want? Also be sure to try it on your own as per the [SO how-to-ask](https://stackoverflow.com/help/how-to-ask) post. – t.o. Sep 02 '22 at 16:25
1 Answers
1
I think you could follow this pattern
from matplotlib.gridspec import GridSpec
# do not forget constrained_layout=True to have some space between axes
fig = plt.figure(constrained_layout=True)
gs = GridSpec(2, 2, figure=fig)
ax1 = fig.add_subplot(gs[0, :])
# identical to ax1 = plt.subplot(gs.new_subplotspec((0, 0), colspan=2))
ax2 = fig.add_subplot(gs[1, 0])
ax3 = fig.add_subplot(gs[1, 1])
plt.show()

Lucas M. Uriarte
- 2,403
- 5
- 19