Hello Markus, On Saturday 10 May 2008 22:01:22 Markus Kuhn wrote: > 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')
An axes instance does not provide data-properties. They belong to the lines, that were already plotted in that axes. But the axes instance provides a list of all plotted lines (gca().lines). xdata = getp(gca().lines[0], 'xdata') # or the OOP-way # last line instance of the list of lines: line = gca().lines[-1] ydata = line.get_ydata() regards Matthias > P.S.: It seems that the link > > http://matplotlib.sourceforge.net/matplotlib.pyplot.html#-getp > > on > > http://matplotlib.sourceforge.net/ > > is broken. (+1) ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users