code: def plot_scores(word_spans, scores):
      fig, ax = plt.subplots()
      span_xs, span_hs = [], []
      ax.axvspan(
          word_spans[0][0].start - 0.05,
          word_spans[-1][-1].end + 0.05,
          facecolor="paleturquoise",
          edgecolor="none",
          zorder=-1,
      )
      for t_span in word_spans:
          for span in t_span:
              for t in range(span.start, span.end):
                  span_xs.append(t + 0.5)
                  span_hs.append(scores[t].item())
              ax.annotate(LABELS[span.token], (span.start, -0.07))
          ax.axvspan(
              t_span[0].start - 0.05,
              t_span[-1].end + 0.05,
              facecolor="mistyrose",
              edgecolor="none",
              zorder=-1,
          )
      ax.bar(span_xs, span_hs, color="lightsalmon", edgecolor="coral")
      ax.set_title("Frame-level scores and word segments")
      ax.set_ylim(-0.1, None)
      ax.grid(True, axis="y")
      ax.axhline(0, color="black")
      fig.tight_layout()
  
file_path: audio/examples/tutorials/ctc_forced_alignment_api_tutorial.py
imports: import torch
  import torchaudio
  import IPython
  import matplotlib.pyplot
  import torchaudio.functional
label_desc: Use image node_id 7 for calling a global function with example usage: plot_scores(word_spans, scores) without return types