code: def index_to_coordinate(index, extent, origin):
      """Return the pixel center of an index."""
      left, right, bottom, top = extent
  
      hshift = 0.5 * np.sign(right - left)
      left, right = left + hshift, right - hshift
      vshift = 0.5 * np.sign(top - bottom)
      bottom, top = bottom + vshift, top - vshift
  
      if origin == "upper":
          bottom, top = top, bottom
  
      return {
          "[0, 0]": (left, bottom),
          "[M', 0]": (left, top),
          "[0, N']": (right, bottom),
          "[M', N']": (right, top),
      }[index]
  
file_path: matplotlib/galleries/users_explain/artists/imshow_extent.py
imports: import matplotlib.pyplot
  import numpy
  from matplotlib.gridspec import GridSpec
label_desc: Use image node_id 1 for calling a global function with example usage: index_to_coordinate(index, extent, origin) and returns: dict