Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 556d053

Browse filesBrowse files
authored
Merge pull request #14093 from meeseeksmachine/auto-backport-of-pr-14052-on-v3.1.x
Backport PR #14052 on branch v3.1.x (Check axes identity in image.contains.)
2 parents e94d54c + bde677d commit 556d053
Copy full SHA for 556d053

File tree

Expand file treeCollapse file tree

1 file changed

+7
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-0
lines changed

‎lib/matplotlib/image.py

Copy file name to clipboardExpand all lines: lib/matplotlib/image.py
+7Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.