Im trying to remove this gap using gridspec, any hints?
fig = plt.figure(figsize=(10,10))
gs = GridSpec(2,2, hspace=0, figure=fig)
gs1 = GridSpec(2,2, figure=fig, hspace=0, height_ratios = [10,1])
ax1 = fig.add_subplot(gs[0,0])
ax2 = fig.add_subplot(gs[0,1])
plt.subplots_adjust(wspace=None, hspace=None)
ax3 = fig.add_subplot(gs1[1,:])
CodePudding user response:
I think you have the first GridSpec with two rows, which is giving the gap. You can keep all three subplots as part of the same grid and adjust the heights of each row/column. Adjust the figsize
and height_ratios
to see the right shaped figures. Hope this helps...
fig = plt.figure(figsize=(8,5))
gs = GridSpec(2,2, figure=fig, height_ratios = [4,1])
ax1 = fig.add_subplot(gs[0,0])
ax2 = fig.add_subplot(gs[0,1])
ax3 = fig.add_subplot(gs[1,:])