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.
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:
x = FigurePanel.axes.GetXData()
y = FigurePanel.axes.GetYData()
Hopefully that makes some sense :)
Thanks so much! Any help is greatly appreciated!
edit: 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 ;)