title: Retrieve XY data from matplotlib figure
body: <p>I'm writing a little app in wxPython which has a matplotlib figure (using the wxagg backend) panel.  I'd like to add the ability for the user to export X,Y data of what is currently plotted in the figure to a text file.  Is there a non-invasive way to do this?  I've searched quite a bit and can't seem to find anything, though I feel like it is incredibly simple and right in front of my face.</p>
  
  <p>I could definitely get the data and store it somewhere when it is plotted, and use that - but that would be fairly invasive, into the lower levels of my code. It would be so much easier, and universal, if I could do something as easy as:</p>
  
  <pre><code>x = FigurePanel.axes.GetXData()
  y = FigurePanel.axes.GetYData()
  </code></pre>
  
  <p>Hopefully that makes some sense :)</p>
  
  <p>Thanks so much!  Any help is greatly appreciated!</p>
  
  <p><strong>edit</strong>: to clarify, what I'd like to know how to do is get the X,Y data.  Writing to the text file after that is trivial ;)</p>