I have followed the answer on this thread Seaborn Heatmap: Move colorbar on top of the plot regarding positioning a colorbar on a figure.
However I would like to shrink the colorbar to 50% of the default. If I read the docstring for the colorbar function it suggests I can pass the keyword argument "shrink".
This is the code I've written (where HM is a seaborn heatmap):
from mpl_toolkits.axes_grid1.colorbar import colorbar
HM_divider = make_axes_locatable(HM)
# define size and padding of axes for colorbar
cax = HM_divider.append_axes('right', size = '5%', pad = '25%')
# make colorbar for heatmap.
# Heatmap returns an axes obj but you need to get a mappable obj (get_children)
colorbar(HM.get_children()[0], cax = cax, orientation = 'vertical', shrink=0.5)
But when I run this I get a TypeError: TypeError: __init__() got an unexpected keyword argument 'shrink'