docs: def add_selection(self, pi):
          """
          Create an annotation for a `Selection` and register it.
  
          Returns a new `Selection`, that has been registered by the `Cursor`,
          with the added annotation set in the :attr:`annotation` field and, if
          applicable, the highlighting artist in the :attr:`extras` field.
  
          Emits the ``"add"`` event with the new `Selection` as argument.  When
          the event is emitted, the position of the annotation is temporarily
          set to ``(nan, nan)``; if this position is not explicitly set by a
          callback, then a suitable position will be automatically computed.
  
          Likewise, if the text alignment is not explicitly set but the position
          is, then a suitable alignment will be automatically computed.
          """
          # pi: "pick_info", i.e. an incomplete selection.
          # Pre-fetch the figure and axes, as callbacks may actually unset them.
          figure = pi.artist.figure
          axes = pi.artist.axes
          if axes.get_renderer_cache() is None:
              figure.canvas.draw()  # Needed by draw_artist below anyways.
          renderer = pi.artist.axes.get_renderer_cache()
          ann = pi.artist.axes.annotate(
              _pick_info.get_ann_text(*pi), xy=pi.target,
              xytext=(np.nan, np.nan),
              ha=_MarkedStr("center"), va=_MarkedStr("center"),
              visible=self.visible,
              **self.annotation_kwargs)
          ann.draggable(use_blit=not self._multiple)
          extras = []
          if self._highlight:
              hl = self.add_highlight(*pi)
              if hl:
                  extras.append(hl)
          sel = pi._replace(annotation=ann, extras=extras)
          self._selections.append(sel)
          for cb in self._callbacks["add"]:
              cb(sel)
  
          # Check that `ann.axes` is still set, as callbacks may have removed the
          # annotation.
          if ann.axes and ann.xyann == (np.nan, np.nan):
              fig_bbox = figure.get_window_extent()
              ax_bbox = axes.get_window_extent()
              overlaps = []
              for idx, annotation_position in enumerate(
                      self.annotation_positions):
                  ann.set(**annotation_position)
                  # Work around matplotlib/matplotlib#7614: position update is
                  # missing.
                  ann.update_positions(renderer)
                  bbox = ann.get_window_extent(renderer)
                  overlaps.append(
                      (_get_rounded_intersection_area(fig_bbox, bbox),
                       _get_rounded_intersection_area(ax_bbox, bbox),
                       # Avoid needlessly jumping around by breaking ties using
                       # the last used position as default.
                       idx == self._last_auto_position))
              auto_position = max(range(len(overlaps)), key=overlaps.__getitem__)
              ann.set(**self.annotation_positions[auto_position])
              self._last_auto_position = auto_position
          else:
              if isinstance(ann.get_ha(), _MarkedStr):
                  ann.set_ha({-1: "right", 0: "center", 1: "left"}[
                      np.sign(np.nan_to_num(ann.xyann[0]))])
              if isinstance(ann.get_va(), _MarkedStr):
                  ann.set_va({-1: "top", 0: "center", 1: "bottom"}[
                      np.sign(np.nan_to_num(ann.xyann[1]))])
  
          if (extras
                  or len(self.selections) > 1 and not self._multiple
                  or not figure.canvas.supports_blit):
              # Either:
              #  - there may be more things to draw, or
              #  - annotation removal will make a full redraw necessary, or
              #  - blitting is not (yet) supported.
              figure.canvas.draw_idle()
          elif ann.axes:
              # Fast path, only needed if the annotation has not been immediately
              # removed.
              figure.draw_artist(ann)
              # Explicit argument needed on MacOSX backend.
              figure.canvas.blit(figure.bbox)
          # Removal comes after addition so that the fast blitting path works.
          if not self._multiple:
              for sel in self.selections[:-1]:
                  self.remove_selection(sel)
          return sel