code: def demo_right_cbar(fig):
      """
      A grid of 2x2 images. Each row has its own colorbar.
      """
      grid = AxesGrid(
          fig,
          122,  # similar to subplot(122)
          nrows_ncols=(2, 2),
          axes_pad=0.10,
          label_mode="1",
          share_all=True,
          cbar_location="right",
          cbar_mode="edge",
          cbar_size="7%",
          cbar_pad="2%",
      )
      Z, extent = get_demo_image()
      cmaps = ["spring", "winter"]
      for i in range(4):
          im = grid[i].imshow(Z, extent=extent, cmap=cmaps[i // 2])
          if i % 2:
              grid.cbar_axes[i // 2].colorbar(im)
  
      for cax in grid.cbar_axes:
          cax.axis[cax.orientation].set_label("Foo")
  
      # This affects all Axes because we set share_all = True.
      grid.axes_llc.set_xticks([-2, 0, 2])
      grid.axes_llc.set_yticks([-2, 0, 2])
  
imports: import matplotlib.pyplot
  from matplotlib import cbook
  from mpl_toolkits.axes_grid1 import AxesGrid
label_desc: Use image node_id 3 for calling a global function with example usage: demo_right_cbar(fig) without return types