8000 Backport PR #14052: Check axes identity in image.contains. · matplotlib/matplotlib@bde677d · GitHub
[go: up one dir, main page]

Skip to content

Commit bde677d

Browse files
dopplershiftMeeseeksDev[bot]
authored andcommitted
Backport PR #14052: Check axes identity in image.contains.
1 parent b9d3c83 commit bde677d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/matplotlib/image.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,13 @@ def contains(self, mouseevent):
628628
"""
629629
if self._contains is not None:
630630
return self._contains(self, mouseevent)
631+
# 1) This doesn't work for figimage; but figimage also needs a fix
632+
# below (as the check cannot use x/ydata and extents).
633+
# 2) As long as the check below uses x/ydata, we need to test axes
634+
# identity instead of `self.axes.contains(event)` because even if
635+
# axes overlap, x/ydata is only valid for event.inaxes anyways.
636+
if self.axes is not mouseevent.inaxes:
637+
return False, {}
631638
# TODO: make sure this is consistent with patch and patch
632639
# collection on nonlinear transformed coordinates.
633640
# TODO: consider returning image coordinates (shouldn't

0 commit comments

Comments
 (0)
0