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

Function test_quadmesh_cursor_data

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

Source from the content-addressed store, hash-verified

614
615
616def test_quadmesh_cursor_data():
617 x = np.arange(4)
618 X = x[:, None] * x[None, :]
619
620 fig, ax = plt.subplots()
621 mesh = ax.pcolormesh(X)
622 # Empty array data
623 mesh._A = None
624 fig.draw_without_rendering()
625 xdata, ydata = 0.5, 0.5
626 x, y = mesh.get_transform().transform((xdata, ydata))
627 mouse_event = SimpleNamespace(xdata=xdata, ydata=ydata, x=x, y=y)
628 # Empty collection should return None
629 assert mesh.get_cursor_data(mouse_event) is None
630
631 # Now test adding the array data, to make sure we do get a value
632 mesh.set_array(np.ones(X.shape))
633 assert_array_equal(mesh.get_cursor_data(mouse_event), [1])
634
635
636def test_quadmesh_cursor_data_multiple_points():

Callers

nothing calls this directly

Calls 7

pcolormeshMethod · 0.80
subplotsMethod · 0.45
transformMethod · 0.45
get_transformMethod · 0.45
get_cursor_dataMethod · 0.45
set_arrayMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…