I’m trying to use an AxesGrid to plot 5 images and a color bar. I can’t work out how to get labels on the colorbar, and none of the examples shows this. Can anyone help? I presume this is a simple thing, once one knows the correct command.
I’m creating the grid using the following code snippet, taking almost verbatim from the examples:
fig = plt.figure()
grid = AxesGrid(fig, 111, nrows_ncols = (1, 5), axes_pad = 0.05, share_all=True, cbar_mode=‘single’, cbar_location=‘right’, cbar_size=‘15%’)
for i in xrange(5):
im = grid[i].imshow(array[i])
but then it’s not clear how to switch on the labels. Things I’ve tried: normal colorbars come with them on by default. I’ve also found that grid.cbar_axes is a list of five elements, each of which is an CbarAxes, for which I can’t find documentation on the website, and doing grid.cbar_axes.set_yticks/set_yticklabels on at least the first and last elements of the list doesn’t work. Can anyone shed light on this? I bet it’s easy once I know the magic words.
Post-doctoral research fellow
Neurobiology, University of Pittsburgh