class_docstr: List of scales
  
  This class has methods the simplify the handling of
  the ggplot object scales
class_docstr_tok: ["List","of","scales","This","class","has","methods","the","simplify","the","handling","of","the","ggplot","object","scales"]
docstr: Map the data onto the scales
  
  The scales should be for the same aesthetic
  e.g. x scales, y scales, color scales, ...
  
  Parameters
  ----------
  data : dataframe
      data with columns to map
      This is modified inplace
  vars : list | tuple
      columns to map
  idx : array_like
      indices that link the data points to the
      scales. These start at 1, so subtract 1 to
      get the true index into the scales array
docstr_tok: ["Map","the","data","onto","the","scales","The","scales","should","be","for","the","same","aesthetic","e.g",".","x","scales",",","y","scales",",","color","scales",",","...","Parameters","--","--","--","--","--","data",":","dataframe","data","with","columns","to","map","This","is","modified","inplace","vars",":","list","|","tuple","columns","to","map","idx",":","array_like","indices","that","link","the","data","points","to","the","scales",".","These","start","at","1",",","so","subtract","1","to","get","the","true","index","into","the","scales","array"]
code: def map(self, data, vars, idx):
      """
      Map the data onto the scales
  
      The scales should be for the same aesthetic
      e.g. x scales, y scales, color scales, ...
  
      Parameters
      ----------
      data : dataframe
          data with columns to map
          This is modified inplace
      vars : list | tuple
          columns to map
      idx : array_like
          indices that link the data points to the
          scales. These start at 1, so subtract 1 to
          get the true index into the scales array
      """
      idx = np.asarray(idx)
      # discrete scales change the dtype
      # from category to int. Use a new dataframe
      # to collect these results.
      # Using `type` preserves the subclass of pd.DataFrame
      discrete_data = type(data)(index=data.index)
  
      # Loop through each variable, mapping across each scale,
      # then joining back into the copy of the data
      for col in vars:
          use_df = array_kind.discrete(data[col])
          for i, sc in enumerate(self, start=1):
              bool_idx = i == idx
              results = sc.map(data.loc[bool_idx, col])
              if use_df:
                  discrete_data.loc[bool_idx, col] = results
              else:
                  data.loc[bool_idx, col] = results
  
      for col in discrete_data:
          data[col] = discrete_data[col]
  
imports: from __future__ import annotations
  import itertools
  import typing
  from contextlib import suppress
  from typing import List
  from warnings import warn
  import numpy
  import pandas.api.types
  from .._utils import array_kind
  from .._utils.registry import Registry
  from ..exceptions import PlotnineError, PlotnineWarning
  from ..mapping.aes import aes_to_scale
  from .scale import scale
label_desc: Use image node_id 10 for calling the Scales obj's underlying member method code with example usage: obj.map(data, vars, idx) without return types