code: def online_classify(t):
      global colors, ts_visu
  
      # Online classification
      y = mdm.predict(x_test[np.newaxis, t])
      color = clist[int(y[0] - 1)]
      ts_test = pga.transform(x_test[np.newaxis, t])
  
      # Update data
      colors.append(color)
      ts_visu = np.vstack((ts_visu, ts_test))
      if len(ts_visu) > test_visu:
          colors.pop(0)
          ts_visu = ts_visu[1:]
      colors = _add_alpha(colors, alphas)
  
      # Update plot
      pl.set_offsets(np.c_[ts_visu[:, 0], ts_visu[:, 1]])
      pl.set_color(colors)
      return pl
  
file_path: pyRiemann/examples/SSVEP/plot_classify_ssvep_pga.py
imports: import numpy
  import matplotlib.pyplot
  from matplotlib.animation import FuncAnimation
  from mne import find_events, Epochs, make_fixed_length_epochs
  from mne.io import Raw
  from sklearn.pipeline import make_pipeline
  from sklearn.decomposition import PCA
  from pyriemann.estimation import BlockCovariances
  from pyriemann.classification import MDM
  from pyriemann.tangentspace import TangentSpace
  from pyriemann.utils.viz import _add_alpha
  from helpers.ssvep_helpers import download_data, extend_signal
label_desc: Use image node_id 2 for calling a global function with example usage: online_classify(t) and returns: pl