How to subdivide Axes using GridSpec in PyPlot?

import matplotlib.gridspec as gridspec
gs = ax.get_gridspec()
subgs = gridspec.GridSpecFromSubplotSpec(
    2, 2,
    subplot_spec=gs,
    wspace=0.1, hspace=0.1)
for it in range(len(subgs))
    ax = plt.Subplot(fig, inner[it])
    # ax.plot(...)

Know more: