From: Markus K. <Mar...@cl...> - 2008-05-10 20:01:30
|
How can I extract from a figure or axes the data that it currently displays? I had hoped that something like from pylab import * plot([1,3,2]) data = getp(gca(), 'data') xdata = getp(gca(), 'xdata') ydata = getp(gca(), 'ydata') would do the trick, as suggested by the brief mention of these properties at http://matplotlib.sourceforge.net/matplotlib.pyplot.html#-plot but all I get is the exception Traceback (most recent call last): File "bug.py", line 3, in <module> data = getp(gca(), 'data') File "/usr/lib/python2.5/site-packages/matplotlib/artist.py", line 629, in getp func = getattr(o, 'get_' + name) AttributeError: Subplot instance has no attribute 'get_data' in python-matplotlib-0.91.1. Thanks for any suggestions! Markus P.S.: It seems that the link http://matplotlib.sourceforge.net/matplotlib.pyplot.html#-getp on http://matplotlib.sourceforge.net/ is broken. -- Markus Kuhn, Computer Laboratory, University of Cambridge http://www.cl.cam.ac.uk/~mgk25/ || CB3 0FD, Great Britain |