MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / findobj

Method findobj

lib/matplotlib/artist.py:1338–1380  ·  view source on GitHub ↗

Find artist objects. Recursively find all `.Artist` instances contained in the artist. Parameters ---------- match A filter criterion for the matches. This can be - *None*: Return all objects contained in artist. - A fun

(self, match=None, include_self=True)

Source from the content-addressed store, hash-verified

1336 self._internal_update(orig_vals)
1337
1338 def findobj(self, match=None, include_self=True):
1339 """
1340 Find artist objects.
1341
1342 Recursively find all `.Artist` instances contained in the artist.
1343
1344 Parameters
1345 ----------
1346 match
1347 A filter criterion for the matches. This can be
1348
1349 - *None*: Return all objects contained in artist.
1350 - A function with signature ``def match(artist: Artist) -> bool``.
1351 The result will only contain artists for which the function
1352 returns *True*.
1353 - A class instance: e.g., `.Line2D`. The result will only contain
1354 artists of this class or its subclasses (``isinstance`` check).
1355
1356 include_self : bool
1357 Include *self* in the list to be checked for a match.
1358
1359 Returns
1360 -------
1361 list of `.Artist`
1362
1363 """
1364 if match is None: # always return True
1365 def matchfunc(x):
1366 return True
1367 elif isinstance(match, type) and issubclass(match, Artist):
1368 def matchfunc(x):
1369 return isinstance(x, match)
1370 elif callable(match):
1371 matchfunc = match
1372 else:
1373 raise ValueError('match must be None, a matplotlib.artist.Artist '
1374 'subclass, or a callable')
1375
1376 artists = reduce(operator.iadd,
1377 [c.findobj(matchfunc) for c in self.get_children()], [])
1378 if include_self and matchfunc(self):
1379 artists.append(self)
1380 return artists
1381
1382 def get_cursor_data(self, event):
1383 """

Callers 3

findobjFunction · 0.80
test_gidFunction · 0.80
findobj_demo.pyFile · 0.80

Calls 1

get_childrenMethod · 0.95

Tested by 1

test_gidFunction · 0.64