code: def plot_tracks(rgb, points, occluded, trackgroup=None):
      """Plot tracks with matplotlib."""
      disp = []
      cmap = plt.cm.hsv
  
      z_list = (
          np.arange(points.shape[0])
          if trackgroup is None
          else np.array(trackgroup)
      )
      # random permutation of the colors so nearby points in the list can get
      # different colors
      z_list = np.random.permutation(np.max(z_list) + 1)[z_list]
      colors = cmap(z_list / (np.max(z_list) + 1))
      figure_dpi = 64
  
      for i in range(rgb.shape[0]):
          fig = plt.figure(
              figsize=(256 / figure_dpi, 256 / figure_dpi),
              dpi=figure_dpi,
              frameon=False,
              facecolor="w",
          )
          ax = fig.add_subplot()
          ax.axis("off")
          ax.imshow(rgb[i])
  
          valid = points[:, i, 0] > 0
          valid = np.logical_and(
              valid, points[:, i, 0] < rgb.shape[2] - 1
          )
          valid = np.logical_and(valid, points[:, i, 1] > 0)
          valid = np.logical_and(
              valid, points[:, i, 1] < rgb.shape[1] - 1
          )
  
          colalpha = np.concatenate(
              [colors[:, :-1], 1 - occluded[:, i : i + 1]], axis=1
          )
          # Note: matplotlib uses pixel corrdinates, not raster.
          plt.scatter(
              points[valid, i, 0] - 0.5,
              points[valid, i, 1] - 0.5,
              s=3,
              c=colalpha[valid],
          )
  
          occ2 = occluded[:, i : i + 1]
  
          colalpha = np.concatenate([colors[:, :-1], occ2], axis=1)
  
          plt.scatter(
              points[valid, i, 0],
              points[valid, i, 1],
              s=20,
              facecolors="none",
              edgecolors=colalpha[valid],
          )
  
          plt.subplots_adjust(
              top=1, bottom=0, right=1, left=0, hspace=0, wspace=0
          )
          plt.margins(0, 0)
          fig.canvas.draw()
          width, height = fig.get_size_inches() * fig.get_dpi()
          img = np.frombuffer(
              fig.canvas.tostring_rgb(), dtype="uint8"
          ).reshape(int(height), int(width), 3)
          disp.append(np.copy(img))
          plt.close(fig)
  
      return np.stack(disp, axis=0)
  
imports: import functools
  import itertools
  import matplotlib.pyplot
  import mediapy
  import numpy
  import tensorflow.compat.v1
  import tensorflow_datasets
  from tensorflow_graphics.geometry.transformation import rotation_matrix_3d
label_desc: Use image node_id 14 for calling a global function with example usage: plot_tracks(rgb, points, occluded, trackgroup) and returns: np