title: Python and Matplotlib and Annotations with Mouse Hover
body: <p>I am currently employing this code to have pop up annotatations on a map when i click on a point in a Basemap Matplotlib Plot.  </p>
  
  <pre><code>dcc = DataCursor(self.figure.gca())
  self.figure.canvas.mpl_connect('pick_event',dcc)
  plot_handle.set_picker(5)
  self.figure.canvas.draw()
  
  class DataCursor(object):
  
      import matplotlib.pyplot as plt
  
      text_template = 'x: %0.2f\ny: %0.2f' 
      x, y = 0.0, 0.0 
      xoffset, yoffset = -20 , 20
      text_template = 'A: %s\nB: %s\nC: %s'
  
  
      def __init__(self, ax): 
          self.ax = ax 
          self.annotation = ax.annotate(self.text_template,  
                  xy=(self.x, self.y), xytext=(0,0),
                  textcoords='axes fraction', ha='left', va='bottom', fontsize=10,
                  bbox=dict(boxstyle='round,pad=0.5', fc='yellow', alpha=1), 
                  arrowprops=dict(arrowstyle='-&gt;', connectionstyle='arc3,rad=0') 
                  ) 
          self.annotation.set_visible(False)
          self.annotation.draggable()
  
  
      def __call__(self, event):
  
          self.event = event 
          self.x, self.y = event.mouseevent.xdata, event.mouseevent.ydata
  
          if self.x is not None:
              glim = pickle.load(open("ListA.py","rb"))
              tlim = pickle.load(open("ListB.py","rb"))
              vlim = pickle.load(open("ListC.py","rb"))
              a = glim[event.ind[0]] # ['Name'][event.ind[0]]
              b = tlim[event.ind[0]]
              c = vlim[event.ind[0]]
              temp_temp=self.text_template % (a, b, c)
              if temp_temp == self.annotation.get_text() and self.annotation.get_visible(): 
                  self.annotation.set_visible(False) 
                  event.canvas.draw() 
                  return 
              self.annotation.xy = self.x, self.y
              self.annotation.set_text(self.text_template % (a, b, c))
              self.annotation.set_visible(True)
  
              event.canvas.draw()
  </code></pre>
  
  <p>What I am wondering, is how to show the annotations using mouse hover rather than clicking on a point?  </p>
  
  <p>I have seen "motion_notify_event" but it seems the code gets errors when i move the mouse around the plot area.  Any Thoughts?</p>