code: def onpick1(event):
      if isinstance(event.artist, Line2D):
          thisline = event.artist
          xdata = thisline.get_xdata()
          ydata = thisline.get_ydata()
          ind = event.ind
          print(
              "onpick1 line:", np.column_stack([xdata[ind], ydata[ind]])
          )
      elif isinstance(event.artist, Rectangle):
          patch = event.artist
          print("onpick1 patch:", patch.get_path())
      elif isinstance(event.artist, Text):
          text = event.artist
          print("onpick1 text:", text.get_text())
  
file_path: matplotlib/galleries/examples/event_handling/pick_event_demo.py
imports: import matplotlib.pyplot
  import numpy
  from numpy.random import rand
  from matplotlib.image import AxesImage
  from matplotlib.lines import Line2D
  from matplotlib.patches import Rectangle
  from matplotlib.text import Text
label_desc: Use image node_id 1 for calling a global function with example usage: onpick1(event) without return types