On Sat, Oct 15, 2011 at 10:39 AM, <josef.p...@gmail.com> wrote: > I'm building plots in stages using several different functions. Since > the figure contains all information, I don't hand handles to > individual elements around. > > What's the best way to check for a specific plot element? using > isinstance, or are there specific attributes that could be checked?
Checkout out Artist.findobj http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.artist.Artist.findobj Artist is the base class for everything in a matplotlib figure, the Figure, Axes, Axis, Text, Line2D, Polygon, etc, all derive from Artist, so you can call this method on any mpl object to recursively search for objects of a given type. By recursive, I mean search the objects children, their children, etc. See also http://matplotlib.sourceforge.net/users/artists.html for more info on the artist hierarchy. But for your specific example, each axes has an `images` attribute, which is a list of images it contains (this is detailed in the artist tutorial linked above, so you could simplify your code with something like: images = np.concatenate([ax.images for ax in fig.axes]) JDH ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users