code: def center_image(self, no_reset=True):
          
          try:
              xy_mn, xy_mx = self.get_limits()
              data_x = float(xy_mn[0] + xy_mx[0]) / 2.0
              data_y = float(xy_mn[1] + xy_mx[1]) / 2.0
  
          except ImageViewNoDataError:
              # No data, so try to get center of any plotted objects
              canvas = self.get_canvas()
              try:
                  data_x, data_y = canvas.get_center_pt()[:2]
  
              except Exception as e:
                  self.logger.error("Can't compute center point: %s" % (str(e)))
                  return
  
          self.panset_xy(data_x, data_y, no_reset=no_reset)
  
          if self.t_['autocenter'] == 'once':
              self.t_.set(autocenter='off')
docs: Pan to the center of the image.
  
          Parameters
          ----------
          no_reset : bool
              See :meth:`set_pan`.