def demo_grid_with_each_cbar_labelled(fig):
 grid = ImageGrid(fig, 144, nrows_ncols=(2, 2), axes_pad=(0.45, 0.15), label_mode='1', share_all=True, cbar_location='right', cbar_mode='each', cbar_size='7%', cbar_pad='2%')
 (Z, extent) = get_demo_image()
 limits = ((0, 1), ((-2), 2), ((-1.7), 1.4), ((-1.5), 1))
 for i in range(4):
  im = grid[i].imshow(Z, extent=extent, interpolation='nearest', vmin=limits[i][0], vmax=limits[i][1])
  grid.cbar_axes[i].colorbar(im)
 for (i, cax) in enumerate(grid.cbar_axes):
  cax.set_yticks((limits[i][0], limits[i][1]))
 grid.axes_llc.set_xticks([(-2), 0, 2])
 grid.axes_llc.set_yticks([(-2), 0, 2])

def demo_grid_with_each_cbar_labelled ( fig ) : grid = ImageGrid ( fig , 144 , nrows_ncols = ( 2 , 2 ) , axes_pad = ( 0.45 , 0.15 ) , label_mode = '1' , share_all = True , cbar_location = 'right' , cbar_mode = 'each' , cbar_size = '7%' , cbar_pad = '2%' ) ( Z , extent ) = get_demo_image ( ) limits = ( ( 0 , 1 ) , ( ( - 2 ) , 2 ) , ( ( - 1.7 ) , 1.4 ) , ( ( - 1.5 ) , 1 ) ) for i in range ( 4 ) : im = grid [ i ] . imshow ( Z , extent = extent , interpolation = 'nearest' , vmin = limits [ i ] [ 0 ] , vmax = limits [ i ] [ 1 ] ) grid . cbar_axes [ i ] . colorbar ( im ) for ( i , cax ) in enumerate ( grid . cbar_axes ) : cax . set_yticks ( ( limits [ i ] [ 0 ] , limits [ i ] [ 1 ] ) ) grid . axes_llc . set_xticks ( [ ( - 2 ) , 0 , 2 ] ) grid . axes_llc . set_yticks ( [ ( - 2 ) , 0 , 2 ] )
a grid of 2x2 images .