code: def plot_split_indices(
      cv, cv_args, X, y, groups, n_splits, image_file_path=None
  ):
      """Create a sample plot for indices of a cross-validation object."""
      fig, ax = plt.subplots(figsize=(12, 4))
      cmap_data = plt.cm.tab20
      cmap_cv = plt.cm.coolwarm
      lw = 10
      marker_size = 200
  
      for split_idx, (train_idx, test_idx) in enumerate(
          cv.split(X=X, y=y, groups=groups)
      ):
          indices = np.array([np.nan] * len(X))
          indices[test_idx] = 1
          indices[train_idx] = 0
  
          ax.scatter(
              range(len(X)),
              [split_idx + 0.5] * len(X),
              c=indices,
              marker="_",
              lw=lw,
              cmap=cmap_cv,
              vmin=-0.4,
              vmax=1.4,
              s=marker_size,
          )
  
      ax.scatter(
          range(len(X)),
          [split_idx + 1.5] * len(X),
          c=groups,
          marker="_",
          lw=lw,
          cmap=cmap_data,
          s=marker_size,
      )
  
      yticklabels = list(range(n_splits)) + ["group"]
      ax.set(
          yticks=np.arange(n_splits + 1) + 0.5,
          yticklabels=yticklabels,
          ylabel="CV iteration",
          ylim=[n_splits + 1.2, -0.2],
          xlim=[-0.5, len(indices) - 0.5],
      )
  
      ax.legend(
          [Patch(color=cmap_cv(0.2)), Patch(color=cmap_cv(0.8))],
          ["Training set", "Testing set"],
          loc=(1.02, 0.8),
          fontsize=13,
      )
  
      ax.set_title(
          "{}\n{}".format(type(cv).__name__, cv_args), fontsize=15
      )
      ax.xaxis.set_major_locator(
          MaxNLocator(min_n_ticks=len(X), integer=True)
      )
      ax.set_xlabel(xlabel="Sample index", fontsize=13)
      ax.set_ylabel(ylabel="CV iteration", fontsize=13)
      ax.tick_params(axis="both", which="major", labelsize=13)
      ax.tick_params(axis="both", which="minor", labelsize=13)
  
      plt.tight_layout()
  
      if image_file_path:
          plt.savefig(image_file_path, bbox_inches="tight")
  
      plt.show()
  
file_path: mlxtend/mlxtend/evaluate/time_series.py
imports: from itertools import accumulate, chain, groupby, islice
  import matplotlib.pyplot
  import numpy
  from matplotlib.patches import Patch
  from matplotlib.ticker import MaxNLocator
  from sklearn.utils import indexable
label_desc: Use image node_id 2 for calling a global function with example usage: plot_split_indices(cv, cv_args, X, y, groups, n_splits, image_file_path) without return types