code: def train(self, data, vars, idx):
          
          idx = np.asarray(idx)
          for col in vars:
              for i, sc in enumerate(self, start=1):
                  bool_idx = (i == idx)
                  sc.train(data.loc[bool_idx, col])
docs: Train the scales on the data.
          The scales should be for the same aesthetic
          e.g. x scales, y scales, color scales, ...
  
          Parameters
          ----------
          data : dataframe
              data to use for training
          vars : list | tuple
              columns in data to use for training.
              These should be all the aesthetics of
              a scale type that are present in the
              data. e.g x, xmin, xmax
          idx : array-like
              indices that map the data points to the
              scales. These start at 1, so subtract 1 to
              get the true index into the scales array