code: def _set_range(self, init):
          
  
          if init and (self._scale_factor is not None):
              return  # We don't have to set our scale factor
  
          # Get window size (and store factor now to sync with resizing)
          w, h = self._viewbox.size
          w, h = float(w), float(h)
  
          # Get range and translation for x and y
          x1, y1, z1 = self._xlim[0], self._ylim[0], self._zlim[0]
          x2, y2, z2 = self._xlim[1], self._ylim[1], self._zlim[1]
          rx, ry, rz = (x2 - x1), (y2 - y1), (z2 - z1)
  
          # Correct ranges for window size. Note that the window width
          # influences the x and y data range, while the height influences
          # the z data range.
          if w / h > 1:
              rx /= w / h
              ry /= w / h
          else:
              rz /= h / w
  
          # Convert to screen coordinates. In screen x, only x and y have effect.
          # In screen y, all three dimensions have effect. The idea of the lines
          # below is to calculate the range on screen when that will fit the
          # data under any rotation.
          rxs = (rx**2 + ry**2)**0.5
          rys = (rx**2 + ry**2 + rz**2)**0.5
  
          self.scale_factor = max(rxs, rys) * 1.04
docs: Reset the camera view using the known limits.