code: def dispersion_plot(
      text, words, ignore_case=False, title="Lexical Dispersion Plot"
  ):
      """
      Generate a lexical dispersion plot.
  
      :param text: The source text
      :type text: list(str) or iter(str)
      :param words: The target words
      :type words: list of str
      :param ignore_case: flag to set if case should be ignored when searching text
      :type ignore_case: bool
      :return: a matplotlib Axes object that may still be modified before plotting
      :rtype: Axes
      """
  
      try:
          import matplotlib.pyplot as plt
      except ImportError as e:
          raise ImportError(
              "The plot function requires matplotlib to be installed. "
              "See https://matplotlib.org/"
          ) from e
  
      word2y = {
          word.casefold() if ignore_case else word: y
          for y, word in enumerate(reversed(words))
      }
      xs, ys = [], []
      for x, token in enumerate(text):
          token = token.casefold() if ignore_case else token
          y = word2y.get(token)
          if y is not None:
              xs.append(x)
              ys.append(y)
  
      words = words[::-1]
  
      _, ax = plt.subplots()
      ax.plot(xs, ys, "|")
      ax.dataLim.x0, ax.dataLim.x1 = 0, len(text) - 1
      ax.autoscale(axis="x")
      ax.set_yticks(list(range(len(words))), words, color="C0")
      ax.set_ylim(-1, len(words))
      ax.set_title(title)
      ax.set_xlabel("Word Offset")
      return ax
  
label_desc: Use image node_id 1 for calling a global function with example usage: dispersion_plot(text, words, ignore_case, title) and returns: ax