class_docstr: A cross-hair cursor using blitting for faster redraw.
class_docstr_tok: ["A","cross-hair","cursor","using","blitting","for","faster","redraw","."]
code: def on_mouse_move(self, event):
      if self.background is None:
          self.create_new_background()
      if not event.inaxes:
          need_redraw = self.set_cross_hair_visible(False)
          if need_redraw:
              self.ax.figure.canvas.restore_region(self.background)
              self.ax.figure.canvas.blit(self.ax.bbox)
      else:
          self.set_cross_hair_visible(True)
          # update the line positions
          x, y = event.xdata, event.ydata
          self.horizontal_line.set_ydata([y])
          self.vertical_line.set_xdata([x])
          self.text.set_text(f"x={x:1.2f}, y={y:1.2f}")
  
          self.ax.figure.canvas.restore_region(self.background)
          self.ax.draw_artist(self.horizontal_line)
          self.ax.draw_artist(self.vertical_line)
          self.ax.draw_artist(self.text)
          self.ax.figure.canvas.blit(self.ax.bbox)
  
file_path: matplotlib/galleries/examples/event_handling/cursor_demo.py
imports: import matplotlib.pyplot
  import numpy
  from matplotlib.backend_bases import MouseEvent
label_desc: Use image node_id 5 for calling the BlittedCursor obj's underlying member method code with example usage: obj.on_mouse_move(event) without return types