fig = plt.figure(figsize = (18,18))
ax0 = plt.subplot2grid((3, 48), (0, 0), colspan=16,rowspan=1)
axcb = plt.subplot2grid((3, 48), (0, 16), colspan=2,rowspan=1)
ax1 = plt.subplot2grid((3, 48), (0, 24), colspan=24,rowspan=1)
ax2 = plt.subplot2grid((3, 48), (1, 0), colspan=16,rowspan=1)
ax3 = plt.subplot2grid((3, 48), (1, 16), colspan=16,rowspan=1)
ax4 = plt.subplot2grid((3, 48), (1, 32), colspan=16,rowspan=1)
ax5 = plt.subplot2grid((3, 48), (2, 0), colspan=16,rowspan=1)
ax6 = plt.subplot2grid((3, 48), (2, 16), colspan=16,rowspan=1)
ax7 = plt.subplot2grid((3, 48), (2,32), colspan=16,rowspan=1)
axes = [ax2,ax3,ax4,ax4,ax5,ax6,ax7]
vmin = -1
vmax = 1
p0 = ax0.pcolormesh(ds_lp.z_inst,vmin = vmin, vmax = vmax,cmap = 'RdBu_r')
ax2.pcolormesh(ds_lp2.z_LM_at_mean,vmin = vmin, vmax = vmax,cmap = 'RdBu_r')
ax5.pcolormesh(ds_lp2.z_inst_at_mean - ds_lp2.z_LM_at_mean,vmin = vmin, vmax = vmax,cmap = 'RdBu_r')
ax3.pcolormesh(ds_lp.z_LM_at_mean,vmin = vmin, vmax = vmax,cmap = 'RdBu_r')
ax6.pcolormesh(ds_lp.z_inst_at_mean - ds_lp.z_LM_at_mean,vmin = vmin, vmax = vmax,cmap = 'RdBu_r')
ax4.pcolormesh(ds_lbp.z_LM_at_mean,vmin = vmin, vmax = vmax,cmap = 'RdBu_r')
ax7.pcolormesh(ds_lbp.z_inst_at_mean - ds_lbp.z_LM_at_mean,vmin = vmin, vmax = vmax,cmap = 'RdBu_r')
fig.colorbar(p0,cax=axcb,orientation='vertical',label='Relative vorticity',pad=-1, aspect=30)
textposx = 8
textposy = 234
bbox=dict(facecolor='white', edgecolor='none', boxstyle='round')
ax0.text(textposx,textposy,r'a) $\zeta(\mathbf{x})$',bbox=bbox)
ax2.text(textposx,textposy-5,r'c) $\overline{\zeta}^\mathrm{L}(\mathbf{x})$, both waves filtered',bbox=bbox)
ax3.text(textposx,textposy-5,r'd) $\overline{\zeta}^\mathrm{L}(\mathbf{x})$, mode 2 filtered',bbox=bbox)
ax4.text(textposx,textposy-5,r'e) $\overline{\zeta}^\mathrm{L}(\mathbf{x})$, mode 1 filtered',bbox=bbox)
ax5.text(textposx,textposy,r'f) $\zeta_{\mathrm{L2}}^\mathrm{w}$, both waves',bbox=bbox)
ax6.text(textposx,textposy,r'g) $\zeta_{\mathrm{L2}}^\mathrm{w}$, mode 2 wave',bbox=bbox)
ax7.text(textposx,textposy,r'h) $\zeta_{\mathrm{L2}}^\mathrm{w}$, mode 1 wave',bbox=bbox)
omega = np.linspace(-12,12,1000)
ghat_lp1 = np.zeros_like(omega)
ghat_lp1[np.abs(omega)< 2] = 1
ghat_lp2 = np.zeros_like(omega)
ghat_lp2[np.abs(omega)< 5.5] = 1
ghat_bp = np.zeros_like(omega)
ghat_bp[(np.abs(omega) < 2) | (np.abs(omega) > 5.5)] = 1
l1, = ax1.plot(omega,ghat_bp,'dimgrey',linewidth=3,label='Band-pass')
l2, = ax1.plot(omega,ghat_lp1,'--',color='k',linewidth=3,label='Low-pass, $\omega_c = 2$')
l3, = ax1.plot(omega,ghat_lp2,'r-.',linewidth=4,label='Low-pass, $\omega_c = 5.5$')
l4, = ax1.plot(4.17,1,marker='o', color='darkblue',linestyle='None',markersize=10,label='Mode 1 wave')
ax1.plot(-4.17,1,marker='o', color='darkblue',linestyle='None',markersize=10)
l5, = ax1.plot(7.12,1,marker='^', color='darkblue',linestyle='None',markersize=10,label='Mode 2 wave')
ax1.plot(-7.12,1,marker='^', color='darkblue',linestyle='None',markersize=10)
ax1.legend(handles=[l2,l3,l1,l4,l5],loc='upper right',frameon=False,ncol=2,columnspacing=0.2)
ax1.text(-12.5,1.65,'b)',bbox=bbox)
[ax.axes.set_xticklabels([]) for ax in axes];
[ax.axes.set_yticklabels([]) for ax in axes];
ax0.set_xticks([0,128,256])
ax0.set_yticks([0,128,256])
labels = ['0','$\pi$','$2\pi$']
ax0.set_xticklabels(labels)
ax0.set_yticklabels(labels)
ax0.set_xlabel('$x$')
ax0.set_ylabel('$y$')
ax0.set_aspect('equal',anchor='NW')
ax2.set_aspect('equal',anchor='NW')
ax3.set_aspect('equal',anchor='N')
ax4.set_aspect('equal',anchor='NE')
ax5.set_aspect('equal',anchor='SW')
ax6.set_aspect('equal',anchor='S')
ax7.set_aspect('equal',anchor='SE')
ax1.set_ylim([-0.1,1.8])
ax1.set_xlabel(r'$\omega$')
ax1.set_ylabel(r'$\hat{G}(\omega)$')
ax1.set_xticks([-10,-5,0,5,10])
ax1.set_yticks([0,1])
fig.savefig('Figure-7.png',dpi=200,bbox_inches='tight')