Return index and pixel distance to closest index.
(self, x, y)
| 3268 | self._markers.set_animated(val) |
| 3269 | |
| 3270 | def closest(self, x, y): |
| 3271 | """Return index and pixel distance to closest index.""" |
| 3272 | pts = np.column_stack([self.x, self.y]) |
| 3273 | # Transform data coordinates to pixel coordinates. |
| 3274 | pts = self.ax.transData.transform(pts) |
| 3275 | diff = pts - [x, y] |
| 3276 | dist = np.hypot(*diff.T) |
| 3277 | min_index = np.argmin(dist) |
| 3278 | return min_index, dist[min_index] |
| 3279 | |
| 3280 | |
| 3281 | _RECTANGLESELECTOR_PARAMETERS_DOCSTRING = \ |
no test coverage detected