code: def zoom(self, factor, center=None):
          
          assert len(center) in (2, 3, 4)
          # Get scale factor, take scale ratio into account
          if np.isscalar(factor):
              scale = [factor, factor]
          else:
              if len(factor) != 2:
                  raise TypeError("factor must be scalar or length-2 sequence.")
              scale = list(factor)
          if self.aspect is not None:
              scale[0] = scale[1]
  
          # Init some variables
          center = center if (center is not None) else self.center
          # Make a new object (copy), so that allocation will
          # trigger view_changed:
          rect = Rect(self.rect)
          # Get space from given center to edges
          left_space = center[0] - rect.left
          right_space = rect.right - center[0]
          bottom_space = center[1] - rect.bottom
          top_space = rect.top - center[1]
          # Scale these spaces
          rect.left = center[0] - left_space * scale[0]
          rect.right = center[0] + right_space * scale[0]
          rect.bottom = center[1] - bottom_space * scale[1]
          rect.top = center[1] + top_space * scale[1]
          self.rect = rect
docs: Zoom in (or out) at the given center
  
          Parameters
          ----------
          factor : float or tuple
              Fraction by which the scene should be zoomed (e.g. a factor of 2
              causes the scene to appear twice as large).
          center : tuple of 2-4 elements
              The center of the view. If not given or None, use the
              current center.