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

Method pick

lib/matplotlib/artist.py:538–574  ·  view source on GitHub ↗

Process a pick event. Each child artist will fire a pick event if *mouseevent* is over the artist and the artist has picker set. See Also -------- .Artist.set_picker, .Artist.get_picker, .Artist.pickable

(self, mouseevent)

Source from the content-addressed store, hash-verified

536 return self.get_figure(root=False) is not None and self._picker is not None
537
538 def pick(self, mouseevent):
539 """
540 Process a pick event.
541
542 Each child artist will fire a pick event if *mouseevent* is over
543 the artist and the artist has picker set.
544
545 See Also
546 --------
547 .Artist.set_picker, .Artist.get_picker, .Artist.pickable
548 """
549 from .backend_bases import PickEvent # Circular import.
550 # Pick self
551 if self.pickable():
552 picker = self.get_picker()
553 if callable(picker):
554 inside, prop = picker(self, mouseevent)
555 else:
556 inside, prop = self.contains(mouseevent)
557 if inside:
558 PickEvent("pick_event", self.get_figure(root=True).canvas,
559 mouseevent, self, **prop)._process()
560
561 # Pick children
562 for a in self.get_children():
563 # make sure the event happened in the same Axes
564 ax = getattr(a, 'axes', None)
565 if (isinstance(a, mpl.figure.SubFigure)
566 or mouseevent.inaxes is None or ax is None
567 or mouseevent.inaxes == ax):
568 # we need to check if mouseevent.inaxes is None
569 # because some objects associated with an Axes (e.g., a
570 # tick label) can be outside the bounding box of the
571 # Axes and inaxes will be None
572 # also check that ax is None so that it traverse objects
573 # which do not have an axes property but children might
574 a.pick(mouseevent)
575
576 def set_picker(self, picker):
577 """

Callers

nothing calls this directly

Calls 7

pickableMethod · 0.95
get_pickerMethod · 0.95
containsMethod · 0.95
get_figureMethod · 0.95
get_childrenMethod · 0.95
PickEventClass · 0.85
_processMethod · 0.80

Tested by

no test coverage detected