MCPcopy Create free account
hub / github.com/ColdGrub1384/Pyto / contains

Method contains

site-packages/matplotlib/axis.py:1794–1811  ·  view source on GitHub ↗

Test whether the mouse event occurred in the x axis.

(self, mouseevent)

Source from the content-addressed store, hash-verified

1792 axis_name = 'x'
1793
1794 def contains(self, mouseevent):
1795 """Test whether the mouse event occurred in the x axis.
1796 """
1797 if callable(self._contains):
1798 return self._contains(self, mouseevent)
1799
1800 x, y = mouseevent.x, mouseevent.y
1801 try:
1802 trans = self.axes.transAxes.inverted()
1803 xaxes, yaxes = trans.transform_point((x, y))
1804 except ValueError:
1805 return False, {}
1806 l, b = self.axes.transAxes.transform_point((0, 0))
1807 r, t = self.axes.transAxes.transform_point((1, 1))
1808 inaxis = 0 <= xaxes <= 1 and (
1809 b - self.pickradius < y < b or
1810 t < y < t + self.pickradius)
1811 return inaxis, {}
1812
1813 def _get_tick(self, major):
1814 if major:

Callers

nothing calls this directly

Calls 3

callableFunction · 0.50
invertedMethod · 0.45
transform_pointMethod · 0.45

Tested by

no test coverage detected