You are calling both subplots
, which, by default, gives you a single axes, and also adding axes via add_axes
. You should do one or the other, e.g.
...
fig = plt.figure()
ht_ax = fig.add_axes([0.1, 0.1, 0.3, 0.8])
cb_ax = fig.add_axes([0.45, 0.3, 0.02, 0.4])
phyl_ax = fig.add_axes([0.6, 0.1, 0.3, 0.8])
...
--or--
...
fig, ax = plt.subplots(1,2)
fig.subplots_adjust(left=0.15)
ht_ax = ax[0]
phyl_ax = ax[1]
cb_ax=fig.add_axes([0.05, 0.3, 0.02, 0.4])
...
You can use subplots_adjust
and set_aspect
to adjust the layout. You can also use colorbar.make_axes
to get an appropriately sized colorbar axes. Here I also used grid_spec
to get the plots to be a size ratio I liked
gs = gridspec.GridSpec(1, 2, width_ratios=[3, 2])
ht_ax = plt.subplot(gs[0])
phyl_ax = plt.subplot(gs[1])
cb_ax, kw = mpl.colorbar.make_axes(ht_ax, shrink=0.55)
...
cb = mpl.colorbar.ColorbarBase(ax=cb_ax, cmap=cmap, norm=norm, extend='both', **kw)