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 73c0ed6

Browse filesBrowse files
authored
Merge pull request #14052 from anntzer/image-contains
Check axes identity in image.contains.
2 parents 6f20709 + fe924d6 commit 73c0ed6
Copy full SHA for 73c0ed6

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
@@ -625,6 +625,13 @@ def contains(self, mouseevent):
625625
"""
626626
if self._contains is not None:
627627
return self._contains(self, mouseevent)
628+
# 1) This doesn't work for figimage; but figimage also needs a fix
629+
# below (as the check cannot use x/ydata and extents).
630+
# 2) As long as the check below uses x/ydata, we need to test axes
631+
# identity instead of `self.axes.contains(event)` because even if
632+
# axes overlap, x/ydata is only valid for event.inaxes anyways.
633+
if self.axes is not mouseevent.inaxes:
634+
return False, {}
628635
# TODO: make sure this is consistent with patch and patch
629636
# collection on nonlinear transformed coordinates.
630637
# 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.