code: def labels_repartition_metrics(
      *,
      on_train: bool = True,
      emit_train_at: Literal["stream", "experience", "epoch"] = "epoch",
      on_eval: bool = False,
      emit_eval_at: Literal["stream", "experience"] = "stream",
      image_creator: Optional[
          LabelsRepartitionImageCreator
      ] = default_history_repartition_image_creator,
  ) -> List[PluginMetric]:
      """
      Create plugins to monitor the labels repartition.
  
      :param on_train: If True, emit the metrics during training.
      :param emit_train_at: (only if on_train is True) when to emit the training
          metrics.
      :param on_eval:  If True, emit the metrics during evaluation.
      :param emit_eval_at: (only if on_eval is True) when to emit the evaluation
          metrics.
      :param image_creator: The function to use to create an image from the
          history of the labels repartition. It will receive a dictionary of the
          form {label_id: [count_at_step_0, count_at_step_1, ...], ...}
          and the list of the corresponding steps [step_0, step_1, ...].
          If set to None, only the raw data is emitted.
      :return: The list of corresponding plugins.
      """
      plugins: List[PluginMetric] = []
      if on_eval:
          plugins.append(
              LabelsRepartitionPlugin(
                  image_creator=image_creator,
                  mode="eval",
                  emit_reset_at=emit_eval_at,
              )
          )
      if on_train:
          plugins.append(
              LabelsRepartitionPlugin(
                  image_creator=image_creator,
                  mode="train",
                  emit_reset_at=emit_train_at,
              )
          )
  
      return plugins
  
imports: from collections import defaultdict
  from typing import Callable, Dict, Sequence, TYPE_CHECKING, Optional, List, Counter, overload
  from matplotlib.figure import Figure
  from avalanche.evaluation import GenericPluginMetric, Metric, PluginMetric
  from avalanche.evaluation.metric_results import MetricValue, AlternativeValues
  from avalanche.evaluation.metric_utils import stream_type, default_history_repartition_image_creator
  from typing_extensions import Literal
label_desc: Use image node_id 1 for calling a global function with example usage: labels_repartition_metrics() and returns: plugins