class_docstr: Mapping that sets artist sizes according to data values.
class_docstr_tok: ["Mapping","that","sets","artist","sizes","according","to","data","values","."]
docstr: Map the levels of the `size` variable to distinct values.
  
  Parameters
  ----------
  # TODO add generic parameters
docstr_tok: ["Map","the","levels","of","the","`","size","`","variable","to","distinct","values",".","Parameters","--","--","--","--","--","#","TODO","add","generic","parameters"]
code: def __init__(
      self,
      plotter,
      sizes=None,
      order=None,
      norm=None,
  ):
      """Map the levels of the `size` variable to distinct values.
  
      Parameters
      ----------
      # TODO add generic parameters
  
      """
      super().__init__(plotter)
  
      data = plotter.plot_data.get("size", pd.Series(dtype=float))
  
      if data.notna().any():
          map_type = self.infer_map_type(
              norm, sizes, plotter.var_types["size"]
          )
  
          # --- Option 1: numeric mapping
  
          if map_type == "numeric":
              (
                  levels,
                  lookup_table,
                  norm,
                  size_range,
              ) = self.numeric_mapping(
                  data,
                  sizes,
                  norm,
              )
  
          # --- Option 2: categorical mapping
  
          elif map_type == "categorical":
              levels, lookup_table = self.categorical_mapping(
                  data,
                  sizes,
                  order,
              )
              size_range = None
  
          # --- Option 3: datetime mapping
  
          # TODO this needs an actual implementation
          else:
              levels, lookup_table = self.categorical_mapping(
                  # Casting data to list to handle differences in the way
                  # pandas and numpy represent datetime64 data
                  list(data),
                  sizes,
                  order,
              )
              size_range = None
  
          self.map_type = map_type
          self.levels = levels
          self.norm = norm
          self.sizes = sizes
          self.size_range = size_range
          self.lookup_table = lookup_table
  
imports: from __future__ import annotations
  import warnings
  import itertools
  from copy import copy
  from collections import UserString
  from collections.abc import Iterable, Sequence, Mapping
  from numbers import Number
  from datetime import datetime
  import numpy
  import pandas
  import matplotlib
  from seaborn._core.data import PlotData
  from seaborn.palettes import QUAL_PALETTES, color_palette
  from seaborn.utils import _check_argument, _version_predates, desaturate, locator_to_legend_entries, get_color_cycle, remove_na
label_desc: Use image node_id 1 to create a new SizeMapping object from inherited base classes: SemanticMapping with example: obj = SizeMapping(plotter, sizes, order, norm)