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

Method contains

lib/matplotlib/axis.py:2575–2589  ·  view source on GitHub ↗

Test whether the mouse event occurred in the x-axis.

(self, mouseevent)

Source from the content-addressed store, hash-verified

2573 self.offset_text_position = 'bottom'
2574
2575 def contains(self, mouseevent):
2576 """Test whether the mouse event occurred in the x-axis."""
2577 if self._different_canvas(mouseevent):
2578 return False, {}
2579 x, y = mouseevent.x, mouseevent.y
2580 try:
2581 trans = self.axes.transAxes.inverted()
2582 xaxes, yaxes = trans.transform((x, y))
2583 except ValueError:
2584 return False, {}
2585 (l, b), (r, t) = self.axes.transAxes.transform([(0, 0), (1, 1)])
2586 inaxis = 0 <= xaxes <= 1 and (
2587 b - self._pickradius < y < b or
2588 t < y < t + self._pickradius)
2589 return inaxis, {}
2590
2591 def set_label_position(self, position):
2592 """

Callers

nothing calls this directly

Calls 3

_different_canvasMethod · 0.80
invertedMethod · 0.45
transformMethod · 0.45

Tested by

no test coverage detected