Thanks Matthias. That is a helpful example. I have been trying to figure out how to recursively examine all the objects in fig to see if there is a particular settable property. It seems like the algorithm has to be recursive so that it goes deep into all the lists, etc. I have not figured out how to know when you have reached the bottom/end of a trail.
Such a function would let me set any text property in the whole figure without needing to know if it was a text object, label, legend, etc... maybe that is not as valuable as I think it would be though. j Message: 2 Date: Wed, 2 Jul 2008 10:00:31 +0200 From: Matthias Michler <[EMAIL PROTECTED]> Subject: Re: [Matplotlib-users] findobj in pylab To: matplotlib-users@lists.sourceforge.net Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset="iso-8859-1" Hello John, I'm not sure there is a better way, but the following works for me: ---------------------------------------------------------------------------- ---------- from pylab import * fig = figure() # adding some subplots / axes instances subplot(121) x = linspace(-0.5, 1.5, 10) plot(x, 0.5*x**2, 'ro', x, 0.33*x**3, 'bs') for i in [2, 4]: subplot(2,2,i) # get all axes of the figure 'fig' ... allaxes = fig.get_axes() # ... and reset their property x-limits setp(allaxes, 'xlim', (-.5, 1.5)) ax = allaxes[0] # get all lines of the axes 'ax' ... lines = ax.get_lines() # == ax.lines # ... and reset their markerfacecolor setp(lines, 'mfc', 'g') show() ---------------------------------------------------------------------------- ----------- best regards Matthias On Thursday 26 June 2008 00:21:13 John Kitchin wrote: > Is there a way to find all the "axes" objects or "line" object handles > in pylab? In matlab I used to do something like A = findobj(gcf) > Allaxes = findall(a,'Type','axes') > Set(allaxes,'Fontname','Arial') > > Is there a way to do that in pylab/matplotlib? > > Thanks, > > j > > > > ----------------------------------- > John Kitchin > Assistant Professor > NETL-IAES Resident Institute Fellow > Doherty Hall 3112 > Department of Chemical Engineering > Carnegie Mellon University > Pittsburgh, PA 15213 > 412-268-7803 > http://kitchingroup.cheme.cmu.edu > > ----------------------------------- John Kitchin Assistant Professor NETL-IAES Resident Institute Fellow Doherty Hall 3112 Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 http://kitchingroup.cheme.cmu.edu ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users