()
| 571 | |
| 572 | |
| 573 | def test_quadmesh_contains(): |
| 574 | x = np.arange(4) |
| 575 | X = x[:, None] * x[None, :] |
| 576 | |
| 577 | fig, ax = plt.subplots() |
| 578 | mesh = ax.pcolormesh(X) |
| 579 | fig.draw_without_rendering() |
| 580 | xdata, ydata = 0.5, 0.5 |
| 581 | x, y = mesh.get_transform().transform((xdata, ydata)) |
| 582 | mouse_event = SimpleNamespace(xdata=xdata, ydata=ydata, x=x, y=y) |
| 583 | found, indices = mesh.contains(mouse_event) |
| 584 | assert found |
| 585 | assert_array_equal(indices['ind'], [0]) |
| 586 | |
| 587 | xdata, ydata = 1.5, 1.5 |
| 588 | x, y = mesh.get_transform().transform((xdata, ydata)) |
| 589 | mouse_event = SimpleNamespace(xdata=xdata, ydata=ydata, x=x, y=y) |
| 590 | found, indices = mesh.contains(mouse_event) |
| 591 | assert found |
| 592 | assert_array_equal(indices['ind'], [5]) |
| 593 | |
| 594 | |
| 595 | def test_quadmesh_contains_concave(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…