code: def __init__(self, data):
      Visual.__init__(self, self.VERTEX_SHADER, self.FRAGMENT_SHADER)
  
      nsignals, nsamples = data.shape
      # nsamples, nsignals = data.shape
  
      self._data = data
  
      a_index = np.c_[
          np.repeat(np.arange(nsignals), nsamples),
          np.tile(np.arange(nsamples), nsignals),
      ].astype(np.float32)
  
      # Doesn't seem to work nor to be very efficient.
      # indices = nsignals * np.arange(nsamples)
      # indices = indices[None, :] + np.arange(nsignals)[:, None]
      # indices = indices.flatten().astype(np.uint32)
      # self._ibuffer = gloo.IndexBuffer(indices)
  
      self._buffer = gloo.VertexBuffer(data.reshape(-1, 1))
      self.shared_program["a_position"] = self._buffer
      self.shared_program["a_index"] = a_index
  
      x_transform = Function(X_TRANSFORM)
      x_transform["nsamples"] = nsamples
      self.shared_program.vert["get_x"] = x_transform
  
      y_transform = Function(Y_TRANSFORM)
      y_transform["scale"] = Variable(
          "uniform float u_signal_scale", 1.0
      )
      y_transform["nsignals"] = nsignals
      self.shared_program.vert["get_y"] = y_transform
      self._y_transform = y_transform
  
      colormap = Function(DISCRETE_CMAP)
      rng = np.random.RandomState(0)
      cmap = rng.uniform(
          size=(1, nsignals, 3), low=0.5, high=0.9
      ).astype(np.float32)
      tex = gloo.Texture2D((cmap * 255).astype(np.uint8))
      colormap["colormap"] = Variable(
          "uniform sampler2D u_colormap", tex
      )
      colormap["ncolors"] = nsignals
      self.shared_program.frag["get_color"] = colormap
      self._draw_mode = "line_strip"
      self.set_gl_state("translucent", depth_test=False)
  
imports: import numpy
  import math
  from vispy import gloo, app, scene
  from vispy.visuals import Visual
  from vispy.visuals.shaders import Function, Variable
  from vispy.visuals.transforms import TransformSystem, BaseTransform
  from vispy.util.profiler import Profiler
label_desc: Use image node_id 1 to create a new SignalsVisual object from inherited base classes: Visual with example: obj = SignalsVisual(data)