Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 15432dc

Browse files
committed
Add test for #1973
1 parent c04d6e5 commit 15432dc

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,24 @@ def test_hexbin_extent():
424424

425425
ax.hexbin(x, y, extent=[.1, .3, .6, .7])
426426

427+
@cleanup
428+
def test_hexbin_pickable():
429+
# From #1973: Test that picking a hexbin collection works
430+
class FauxMouseEvent:
431+
def __init__(self, x, y):
432+
self.x = x
433+
self.y = y
434+
435+
fig = plt.figure()
436+
437+
ax = fig.add_subplot(111)
438+
data = np.arange(200.)/200.
439+
data.shape = 2, 100
440+
x, y = data
441+
hb = ax.hexbin(x, y, extent=[.1, .3, .6, .7], picker=1)
442+
443+
assert hb.contains(FauxMouseEvent(400, 300))[0]
444+
427445
@image_comparison(baseline_images=['hexbin_log'],
428446
remove_text=True,
429447
extensions=['png'])

0 commit comments

Comments
 (0)