def findobj(self, match=None): """ pyplot signature: findobj(o=gcf(), match=None) Recursively find all :class:matplotlib.artist.Artist instances contained in self. *match* can be - None: return all objects contained in artist (including artist) - function with signature ``boolean = match(artist)`` used to filter matches - class instance: eg Line2D. Only return artists of class type .. plot:: mpl_examples/pylab_examples/findobj_demo.py """ if match is None: # always return True def matchfunc(x): return True elif cbook.issubclass_safe(match, Artist): def matchfunc(x): return isinstance(x, match) elif callable(match): matchfunc = match else: raise ValueError('match must be None, an matplotlib.artist.Artist subclass, or a callable') artists = [] for c in self.get_children(): if matchfunc(c): artists.append(c) artists.extend([thisc for thisc in c.findobj(matchfunc) if matchfunc(thisc)]) if matchfunc(self): artists.append(self) return artists
def findobj(self, match=None, include_self=True): """ Find artist objects. pyplot signature: findobj(o=gcf(), match=None, include_self=True) Recursively find all :class:matplotlib.artist.Artist instances contained in self. *match* can be - None: return all objects contained in artist. - function with signature ``boolean = match(artist)`` used to filter matches - class instance: eg Line2D. Only return artists of class type. If *include_self* is True (default), include self in the list to be checked for a match. .. plot:: mpl_examples/pylab_examples/findobj_demo.py """ if match is None: # always return True def matchfunc(x): return True elif cbook.issubclass_safe(match, Artist): def matchfunc(x): return isinstance(x, match) elif callable(match): matchfunc = match else: raise ValueError('match must be None, a matplotlib.artist.Artist ' 'subclass, or a callable') artists = [] for c in self.get_children(): if matchfunc(c): artists.append(c) artists.extend([ thisc for thisc in c.findobj(matchfunc, include_self=False) if matchfunc(thisc) ]) if include_self and matchfunc(self): artists.append(self) return artists
def findobj(self, match=None, include_self=True): """ Find artist objects. pyplot signature: findobj(o=gcf(), match=None, include_self=True) Recursively find all :class:matplotlib.artist.Artist instances contained in self. *match* can be - None: return all objects contained in artist. - function with signature ``boolean = match(artist)`` used to filter matches - class instance: eg Line2D. Only return artists of class type. If *include_self* is True (default), include self in the list to be checked for a match. .. plot:: mpl_examples/pylab_examples/findobj_demo.py """ if match is None: # always return True def matchfunc(x): return True elif cbook.issubclass_safe(match, Artist): def matchfunc(x): return isinstance(x, match) elif isinstance(match, collections.Callable): matchfunc = match else: raise ValueError('match must be None, a matplotlib.artist.Artist ' 'subclass, or a callable') artists = [] for c in self.get_children(): if matchfunc(c): artists.append(c) artists.extend([thisc for thisc in c.findobj(matchfunc, include_self=False) if matchfunc(thisc)]) if include_self and matchfunc(self): artists.append(self) return artists
def findobj(self, match=None): """ pyplot signature: findobj(o=gcf(), match=None) recursively find all :class:matplotlib.artist.Artist instances contained in self *match* can be - None: return all objects contained in artist (including artist) - function with signature ``boolean = match(artist)`` used to filter matches - class instance: eg Line2D. Only return artists of class type .. plot:: ../mpl_examples/pylab_examples/findobj_demo.py """ if match is None: # always return True def matchfunc(x): return True elif cbook.issubclass_safe(match, Artist): def matchfunc(x): return isinstance(x, match) elif callable(match): matchfunc = match else: raise ValueError( 'match must be None, an matplotlib.artist.Artist subclass, or a callable' ) artists = [] if hasattr(self, 'get_children'): for c in self.get_children(): if matchfunc(c): artists.append(c) artists.extend([ thisc for thisc in c.findobj(matchfunc) if matchfunc(thisc) ]) else: if matchfunc(self): artists.append(self) return artists
def findobj(self, match=None, include_self=True): """ Find artist objects. Recursively find all :class:`~matplotlib.artist.Artist` instances contained in self. *match* can be - None: return all objects contained in artist. - function with signature ``boolean = match(artist)`` used to filter matches - class instance: e.g., Line2D. Only return artists of class type. If *include_self* is True (default), include self in the list to be checked for a match. """ if match is None: # always return True def matchfunc(x): return True elif cbook.issubclass_safe(match, Artist): def matchfunc(x): return isinstance(x, match) elif six.callable(match): matchfunc = match else: raise ValueError("match must be None, a matplotlib.artist.Artist " "subclass, or a callable") artists = [] for c in self.get_children(): if matchfunc(c): artists.append(c) artists.extend([thisc for thisc in c.findobj(matchfunc, include_self=False) if matchfunc(thisc)]) if include_self and matchfunc(self): artists.append(self) return artists
def findobj(self, match=None, include_self=True): """ Find artist objects. Recursively find all :class:`~matplotlib.artist.Artist` instances contained in self. *match* can be - None: return all objects contained in artist. - function with signature ``boolean = match(artist)`` used to filter matches - class instance: e.g., Line2D. Only return artists of class type. If *include_self* is True (default), include self in the list to be checked for a match. """ if match is None: # always return True def matchfunc(x): return True elif cbook.issubclass_safe(match, Artist): def matchfunc(x): return isinstance(x, match) elif callable(match): matchfunc = match else: raise ValueError('match must be None, a matplotlib.artist.Artist ' 'subclass, or a callable') artists = sum([c.findobj(matchfunc) for c in self.get_children()], []) if include_self and matchfunc(self): artists.append(self) return artists