class_docstr: Handle individual variable logic.
class_docstr_tok: ["Handle","individual","variable","logic","."]
docstr: Iterate over models and chains for each variable.
docstr_tok: ["Iterate","over","models","and","chains","for","each","variable","."]
code: def iterator(self):
      """Iterate over models and chains for each variable."""
      if self.combined:
          grouped_data = [[(0, datum)] for datum in self.data]
          skip_dims = self.combine_dims.union({"chain"})
      else:
          grouped_data = [datum.groupby("chain") for datum in self.data]
          skip_dims = self.combine_dims
  
      label_dict = OrderedDict()
      selection_list = []
      for name, grouped_datum in zip(self.model_names, grouped_data):
          for _, sub_data in grouped_datum:
              datum_iter = xarray_var_iter(
                  sub_data,
                  var_names=[self.var_name],
                  skip_dims=skip_dims,
                  reverse_selections=True,
              )
              datum_list = list(datum_iter)
              for _, selection, isel, values in datum_list:
                  selection_list.append(selection)
                  if not selection or not len(selection_list) % len(
                      datum_list
                  ):
                      var_name = self.var_name
                  else:
                      var_name = ""
                  label = self.labeller.make_label_flat(
                      var_name, selection, isel
                  )
                  if label not in label_dict:
                      label_dict[label] = OrderedDict()
                  if name not in label_dict[label]:
                      label_dict[label][name] = []
                  label_dict[label][name].append(values)
  
      y = self.y_start
      for idx, (label, model_data) in enumerate(label_dict.items()):
          for model_name, value_list in model_data.items():
              row_label = self.labeller.make_model_label(
                  model_name, label
              )
              for values in value_list:
                  yield y, row_label, model_name, label, selection_list[
                      idx
                  ], values, self.model_color[model_name]
                  y += self.chain_offset
              y += self.var_offset
          y += self.group_offset
  
imports: from collections import OrderedDict, defaultdict
  from itertools import cycle, tee
  import bokeh.plotting
  import matplotlib.pyplot
  import numpy
  from bokeh.models import Band, ColumnDataSource, DataRange1d
  from bokeh.models.annotations import Title, Legend
  from bokeh.models.tickers import FixedTicker
  from ....sel_utils import xarray_var_iter
  from ....rcparams import rcParams
  from ....stats import hdi
  from ....stats.density_utils import get_bins, histogram, kde
  from ....stats.diagnostics import _ess, _rhat
  from ....utils import conditional_jit
  from ...plot_utils import _scale_fig_size
  from ..None import show_layout
  from .None import backend_kwarg_defaults
label_desc: Use image node_id 2 for calling the VarHandler obj's underlying member method code with example usage: obj.iterator() without return types