title: Editable table in Matplotlib: How to superimpose a TextBox widget on a table cell?
body: <p>I'm progressing towards creating an interactive table in Matplotlib. I want the user to be able to click on a data cell in the table so they can edit its value. Based on the advice of @ImportanceOfBeingErnest <a href="https://stackoverflow.com/q/49848575/1843329">here</a> I've registered a pick event handler for each cell of real data in the table. I can then detect which cell the user has clicked on. But I can't superimpose a <code>TextBox</code> object exactly over the picked cell so that to the user it looks like they're editing the cell they picked.</p>
  
  <p>Dummy code to illustrate the issue:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  
  from matplotlib.table import CustomCell
  from matplotlib.widgets import TextBox
  
  def on_pick(event):
  
      if isinstance(event.artist, CustomCell):
          cell = event.artist
          # Doesn't work because cell.get_y() is negative:
          #text_box_axes = plt.axes([cell.get_x(), cell.get_y(), cell.get_width(), cell.get_height()])
  
          # This doesn't work either but at least you can see the TextBox on the figure!
          text_box_axes = plt.axes([cell.get_x(), -cell.get_y(), cell.get_width(), cell.get_height()])
  
          cell_text = cell.get_text().get_text()
          TextBox(text_box_axes, '', initial=cell_text)
          plt.draw()
  
  column_labels = ('Length', 'Width', 'Height', 'Sold?')
  row_labels = ['Ferrari', 'Porsche']
  data = [[2.2, 1.6, 1.2, True],
          [2.1, 1.5, 1.4, False]]
  table = plt.table(cellText=data, colLabels=column_labels, rowLabels=row_labels, cellLoc='center', loc='bottom')
  text_box = None
  
  celld = table.get_celld()
  for key in celld.keys():
      # Each key is a tuple of the form (row, column).
      # Column headings are in row 0. Row headings are in column -1.
      # So the first item of data in the table is actually at (1, 0).
      if key[0] &gt; 0 and key[1] &gt; -1:
          cell = celld[key]
          cell.set_picker(True)
  
  canvas = plt.gcf().canvas
  canvas.mpl_connect('pick_event', on_pick)
  plt.axis('off')
  
  plt.show()
  </code></pre>
  
  <p>But if I run this and then click on, say, the cell with <code>1.2</code> in it I see this:</p>
  
  <p><a href="https://i.stack.imgur.com/9ejtO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9ejtO.png" alt="enter image description here"></a></p>
  
  <p>So how do I get the bounds of the <code>TextBox</code> to exactly match the bounds of the cell that the user has clicked on?</p>
  
  <p>It seems the axes for the textbox are relative to the whole figure rather than to the table itself.</p>