code: def __init__(self, *args, **kwargs):
      # we'll update the position when the line data is set
      self.text = mtext.Text(0, 0, "")
      super().__init__(*args, **kwargs)
  
      # we can't access the label attr until *after* the line is
      # initiated
      self.text.set_text(self.get_label())
  
file_path: matplotlib/galleries/examples/text_labels_and_annotations/line_with_text.py
imports: import matplotlib.pyplot
  import numpy
  import matplotlib.lines
  import matplotlib.text
  import matplotlib.transforms
label_desc: Use image node_id 1 to create a new MyLine object from inherited base classes: lines with example: obj = MyLine()