def mkfig_imshow(dat,title):
    fig, ax = plt.subplots()
    ax.set_title(title)
    img = ax.imshow(dat, cmap=plt.cm.jet, interpolation='nearest', origin='upper')
    cbar = fig.colorbar(img, ax=ax, aspect=50, pad=0.08, shrink=0.9, orientation='horizontal')

    return fig

fig1 = mkfig_imshow(dat1,'dat1')
fig2 = mkfig_imshow(dat2,'dat2')
plt.show()