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

Method contains

lib/matplotlib/axis.py:2801–2815  ·  view source on GitHub ↗
(self, mouseevent)

Source from the content-addressed store, hash-verified

2799 self.offset_text_position = 'left'
2800
2801 def contains(self, mouseevent):
2802 # docstring inherited
2803 if self._different_canvas(mouseevent):
2804 return False, {}
2805 x, y = mouseevent.x, mouseevent.y
2806 try:
2807 trans = self.axes.transAxes.inverted()
2808 xaxes, yaxes = trans.transform((x, y))
2809 except ValueError:
2810 return False, {}
2811 (l, b), (r, t) = self.axes.transAxes.transform([(0, 0), (1, 1)])
2812 inaxis = 0 <= yaxes <= 1 and (
2813 l - self._pickradius < x < l or
2814 r < x < r + self._pickradius)
2815 return inaxis, {}
2816
2817 def set_label_position(self, position):
2818 """

Callers

nothing calls this directly

Calls 3

_different_canvasMethod · 0.80
invertedMethod · 0.45
transformMethod · 0.45

Tested by

no test coverage detected