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

Function test_quadmesh_contains

lib/matplotlib/tests/test_collections.py:573–592  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

571
572
573def 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
595def test_quadmesh_contains_concave():

Callers

nothing calls this directly

Calls 6

pcolormeshMethod · 0.80
subplotsMethod · 0.45
transformMethod · 0.45
get_transformMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…