class_docstr: Base class for formatting ticks on geographical axes using a
  rectangular projection (e.g. Plate Carree, Mercator).
class_docstr_tok: ["Base","class","for","formatting","ticks","on","geographical","axes","using","a","rectangular","projection","(","e.g",".","Plate","Carree",",","Mercator",")","."]
code: def set_axis(self, axis):
      super().set_axis(axis)
  
      # Set the source and target projections for the formatter
      # setting them to None if we aren't interacting with a GeoAxes
      if self.axis is None or not isinstance(self.axis.axes, GeoAxes):
          self._source_projection = None
          self._target_projection = None
          return
  
      self._source_projection = self.axis.axes.projection
      if not isinstance(
          self._source_projection,
          (ccrs._RectangularProjection, ccrs.Mercator),
      ):
          raise TypeError(
              "This formatter cannot be used with "
              "non-rectangular projections."
          )
      # The transforms need to use the same globe
      self._target_projection = ccrs.PlateCarree(
          globe=self._source_projection.globe
      )
  
imports: import matplotlib
  from matplotlib.ticker import Formatter, MaxNLocator
  import numpy
  import cartopy.crs
  from cartopy.mpl.geoaxes import GeoAxes
label_desc: Use image node_id 5 for calling the _PlateCarreeFormatter obj's underlying member method code with example usage: obj.set_axis(axis) without return types