title: pick_event in Jupyter with matplotlib scatter plot
body: <p>I really like the simplicity with how ipywidgets.interactive works with pandas dataframe but I am having trouble getting data when a point in a scatter plot is selected. </p>
  
  <p>I have looked at some examples that use matplotlib.widgets etc. but none that use it with interactive in Jupyter. It looks like this technique would be described here but it comes up just short:</p>
  
  <p><a href="http://minrk-ipywidgets.readthedocs.io/en/latest/examples/Using%20Interact.html" rel="nofollow noreferrer">http://minrk-ipywidgets.readthedocs.io/en/latest/examples/Using%20Interact.html</a></p>
  
  <p>Here is an ipynb of what I am trying to accomplish:</p>
  
  <pre><code>from ipywidgets import interactive
  import pandas as pd
  import matplotlib.pyplot as plt
  from matplotlib.widgets import Button
  from matplotlib.text import Annotation
  from io import StringIO
  
  data_ssv = """tone_amp_0  tone_freq_0     SNR
  75.303        628.0  68.374
  84.902       8000.0  61.292
  92.856        288.0  70.545
  70.000       2093.0  35.036
  76.511       6834.0  66.952 """
  
  data = pd.read_table(StringIO(data_ssv), sep="\s+", header=0)
  
  col_names=list(data.columns.values)
  plottable_col=( ['tone_amp_0', 'tone_freq_0', 'SNR'] )
  
  def annotate(axis, text, x, y):
      text_annotation = Annotation(text, xy=(x, y), xycoords='data')
      axis.add_artist(text_annotation)
  
  def onpick(event):
      ind = event.ind
      label_pos_x = event.mouseevent.xdata
      label_pos_y = event.mouseevent.ydata
      offset = 0   # just in case two dots are very close, this offset will help the labels not appear one on top of each other
  
      for i in ind:  # if the dots are to close one to another, a list of dots clicked is returned by the matplotlib library
          label = "gen_labels" # generated_labels[i]
          print( "index", i, label )    # step 4: log it for debugging purposes
          ax=plt.gca()
          annotate(ax,label,label_pos_x + offset,label_pos_y + offset)
          ax.figure.canvas.draw_idle()
          offset += 0.01 # alter the offset just in case there are more than one dots affected by the click
  
  
  def update_plot(X='tone_amp_0', Y='tone_frq_0', Z='SNR'):
      plt.scatter(  data.loc[:, [X]],data.loc[:, [Y]], marker='.', edgecolors='none', c=data.loc[:,[Z]], picker=True, cmap='RdYlGn' )
      plt.title(X+' vs '+Y); plt.xlabel(X); plt.ylabel(Y); plt.colorbar().set_label(Z, labelpad=+1)
      plt.grid(); plt.show()
  
  plt.gcf().canvas.mpl_connect('pick_event', onpick)
  
  interactive(update_plot, X=plottable_col, Y=plottable_col, Z=plottable_col)
  </code></pre>
  
  <p>When I select a data point nothing is happening. Not sure how to debug this or understand what I am doing wrong. Can someone point out what I am doing wrong here?</p>