def demo_grid_with_single_cbar(fig):
 grid = ImageGrid(fig, 142, nrows_ncols=(2, 2), axes_pad=0.0, share_all=True, label_mode='L', cbar_location='top', cbar_mode='single')
 (Z, extent) = get_demo_image()
 for i in range(4):
  im = grid[i].imshow(Z, extent=extent, interpolation='nearest')
 grid.cbar_axes[0].colorbar(im)
 for cax in grid.cbar_axes:
  cax.toggle_label(False)
 grid.axes_llc.set_xticks([(-2), 0, 2])
 grid.axes_llc.set_yticks([(-2), 0, 2])

def demo_grid_with_single_cbar ( fig ) : grid = ImageGrid ( fig , 142 , nrows_ncols = ( 2 , 2 ) , axes_pad = 0.0 , share_all = True , label_mode = 'L' , cbar_location = 'top' , cbar_mode = 'single' ) ( Z , extent ) = get_demo_image ( ) for i in range ( 4 ) : im = grid [ i ] . imshow ( Z , extent = extent , interpolation = 'nearest' ) grid . cbar_axes [ 0 ] . colorbar ( im ) for cax in grid . cbar_axes : cax . toggle_label ( False ) grid . axes_llc . set_xticks ( [ ( - 2 ) , 0 , 2 ] ) grid . axes_llc . set_yticks ( [ ( - 2 ) , 0 , 2 ] )
a grid of 2x2 images with a single colorbar .