code: def color_text_boxes(ax, labels, colors, color_arrow=True):
      
      assert len(labels) == len(colors), \
          "Equal no. of colors and lables must be given"
      boxes = ax.findobj(mpl.text.Annotation)
      box_labels = lineid_plot.unique_labels(labels)
      for box in boxes:
          l = box.get_label()
          try:
              loc = box_labels.index(l)
          except ValueError:
              continue  # No changes for this box
          box.set_color(colors[loc])
          if color_arrow:
              box.arrow_patch.set_color(colors[loc])
  
      ax.figure.canvas.draw()
docs: Color text boxes.
  
      Instead of this function, one can pass annotate_kwargs and plot_kwargs to
      plot_line_ids function.