code: def scatterplot(
      points,
      samples=None,
      ids=None,
      link_field=None,
      labels=None,
      sizes=None,
      classes=None,
      marker_size=None,
      cmap=None,
      title=None,
      ax=None,
      ax_equal=False,
      figsize=None,
      style=None,
      buttons=None,
      **kwargs,
  ):
      """Generates an interactive scatterplot of the given points.
  
      You can attach plots generated by this method to an App session via its
      :attr:`fiftyone.core.session.Session.plots` attribute, which will
      automatically sync the session's view with the currently selected points in
      the plot. To enable this functionality, you must pass ``samples`` to this
      method.
  
      This method supports 2D or 3D visualizations, but interactive point
      selection is only available in 2D.
  
      You can use the ``labels`` parameters to define a coloring for the points,
      and you can use the ``sizes`` parameter to scale the sizes of the points.
  
      Args:
          points: a ``num_points x num_dims`` array-like of points
          samples (None): the :class:`fiftyone.core.collections.SampleCollection`
              whose data is being visualized
          ids (None): an array-like of IDs corresponding to the points. If not
              provided but ``samples`` are provided, the appropriate IDs will be
              extracted from the samples
          link_field (None): a field of ``samples`` whose data corresponds to
              ``points``. Can be any of the following:
  
              -   None, if the points correspond to samples
              -   ``"frames"``, if the points correspond to frames
              -   the name of a :class:`fiftyone.core.labels.Label` field, if the
                  points correspond to the labels in this field
          labels (None): data to use to color the points. Can be any of the
              following:
  
              -   the name of a sample field or ``embedded.field.name`` of
                  ``samples`` from which to extract numeric or string values
              -   a :class:`fiftyone.core.expressions.ViewExpression` defining
                  numeric or string values to compute from ``samples`` via
                  :meth:`fiftyone.core.collections.SampleCollection.values`
              -   an array-like of numeric or string values
              -   a list of array-likes of numeric or string values, if
                  ``link_field`` refers to frames and/or a label list field like
                  :class:`fiftyone.core.labels.Detections`
          sizes (None): data to use to scale the sizes of the points. Can be any
              of the following:
  
              -   the name of a sample field or ``embedded.field.name`` of
                  ``samples`` from which to extract numeric values
              -   a :class:`fiftyone.core.expressions.ViewExpression` defining
                  numeric values to compute from ``samples`` via
                  :meth:`fiftyone.core.collections.SampleCollection.values`
              -   an array-like of numeric values
              -   a list of array-likes of numeric or string values, if
                  ``link_field`` refers to frames and/or a label list field like
                  :class:`fiftyone.core.labels.Detections`
          classes (None): a list of classes whose points to plot. Only applicable
              when ``labels`` contains strings
          marker_size (None): the marker size to use. If ``sizes`` are provided,
              this value is used as a reference to scale the sizes of all points
          cmap (None): a colormap recognized by ``matplotlib``
          title (None): a title for the plot
          ax (None): a matplotlib axis to plot in
          ax_equal (False): whether to set ``axis("equal")``
          figsize (None): a ``(width, height)`` for the figure, in inches
          style (None): a style to use for the plot
          buttons (None): a list of ``(label, icon_image, callback)`` tuples
              defining buttons to add to the plot
          **kwargs: optional keyword arguments for matplotlib's ``scatter()``
  
      Returns:
          one of the following
  
          -   an :class:`InteractiveCollection`, for 2D points and when IDs are
              available
          -   a matplotlib figure, otherwise
      """
      points = np.asarray(points)
      num_dims = points.shape[1]
  
      if num_dims not in {2, 3}:
          raise ValueError("This method only supports 2D or 3D points")
  
      (
          points,
          ids,
          labels,
          sizes,
          _,
          classes,
          categorical,
      ) = parse_scatter_inputs(
          points,
          samples=samples,
          ids=ids,
          link_field=link_field,
          labels=labels,
          sizes=sizes,
          classes=classes,
      )
  
      if style is None:
          style = _DEFAULT_STYLE
  
      with plt.style.context(style):
          collection = _plot_scatter(
              points,
              labels=labels,
              sizes=sizes,
              classes=classes,
              categorical=categorical,
              marker_size=marker_size,
              cmap=cmap,
              ax=ax,
              ax_equal=ax_equal,
              figsize=figsize,
              **kwargs,
          )
  
          if title is not None:
              collection.axes.figure.suptitle(title)
  
          if samples is None or num_dims != 2:
              fig = collection.axes.figure
              plt.tight_layout()
              return fig
  
          (
              link_type,
              label_fields,
              selection_mode,
              init_fcn,
          ) = InteractiveCollection.recommend_link_type(
              label_field=link_field,
              samples=samples,
          )
  
          return InteractiveCollection(
              collection,
              ids=ids,
              buttons=buttons,
              link_type=link_type,
              init_view=samples,
              label_fields=label_fields,
              selection_mode=selection_mode,
              init_fcn=init_fcn,
          )
  
imports: import itertools
  import logging
  import numpy
  import matplotlib
  from matplotlib.widgets import Button, LassoSelector
  from matplotlib.path import Path
  import matplotlib.pyplot
  from mpl_toolkits.axes_grid1 import make_axes_locatable
  from mpl_toolkits.axes_grid1.inset_locator import InsetPosition
  from mpl_toolkits.mplot3d import Axes3D
  import sklearn.metrics.pairwise
  import sklearn.metrics
  import eta.core.utils
  import fiftyone.core.context
  import fiftyone.core.utils
  from .base import InteractivePlot
  from .utils import best_fit_line, load_button_icon, parse_lines_inputs, parse_locations, parse_scatter_inputs
label_desc: Use image node_id 7 for calling a global function with example usage: scatterplot(points, samples, ids, link_field, labels, sizes, classes, marker_size, cmap, title, ax, ax_equal, figsize, style, buttons) and returns: InteractiveCollection, fig