code: def image_set_extent(x=None, y=None, axes="gca"):
      
      if axes == "gca": axes = _pylab.gca()
  
      # get the current plot limits
      xlim = axes.get_xlim()
      ylim = axes.get_ylim()
  
      # get the old extent
      extent = axes.images[0].get_extent()
  
      # calculate the fractional extents
      x0     = extent[0]
      y0     = extent[2]
      xwidth = extent[1]-x0
      ywidth = extent[3]-y0
      frac_x1 = (xlim[0]-x0)/xwidth
      frac_x2 = (xlim[1]-x0)/xwidth
      frac_y1 = (ylim[0]-y0)/ywidth
      frac_y2 = (ylim[1]-y0)/ywidth
  
  
      # set the new
      if not x == None:
          extent[0] = x[0]
          extent[1] = x[1]
      if not y == None:
          extent[2] = y[0]
          extent[3] = y[1]
  
  
      # get the new zoom window
      x0     = extent[0]
      y0     = extent[2]
      xwidth = extent[1]-x0
      ywidth = extent[3]-y0
  
      x1 = x0 + xwidth*frac_x1
      x2 = x0 + xwidth*frac_x2
      y1 = y0 + ywidth*frac_y1
      y2 = y0 + ywidth*frac_y2
  
      # set the extent
      axes.images[0].set_extent(extent)
  
      # rezoom us
      axes.set_xlim(x1,x2)
      axes.set_ylim(y1,y2)
  
      # draw
      image_set_aspect(1.0)
docs: Set's the first image's extent, then redraws.
  
      Examples:
      x = [1,4]
      y = [33.3, 22]