I want to create a figure with the layout seen in the image below. Ideally, all the axes must have same dimensions (sorry my paint skills are not very good).
I have found the following tutorial: https://matplotlib.org/stable/tutorials/intermediate/arranging_axes.html, but the solutions seem very complicated. I was wondering if there is an easier way to do this.
Thanks in advance.
Arguably the easiest way to achieve that is by using GridSpec
:
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
gs = GridSpec(3, 4)
fig = plt.figure(tight_layout=True)
ax1 = fig.add_subplot(gs[0, :2])
ax2 = fig.add_subplot(gs[0, 2:])
ax3 = fig.add_subplot(gs[1, :2])
ax4 = fig.add_subplot(gs[1, 2:])
ax5 = fig.add_subplot(gs[2, 1:-1])