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

Skip to content

Commit 0b5185b

Browse files
committed
Reverted the children picker traversal back and added extra check so
that children are picked if the current object does not have an axes property.
1 parent f1dfa06 commit 0b5185b

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

lib/matplotlib/artist.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,17 @@ def pick(self, mouseevent):
348348

349349
# Pick children
350350
for a in self.get_children():
351-
a.pick(mouseevent)
351+
# make sure the event happened in the same axes
352+
ax = getattr(a, 'axes', None)
353+
if mouseevent.inaxes is None or ax is None or \
354+
mouseevent.inaxes == ax:
355+
# we need to check if mouseevent.inaxes is None
356+
# because some objects associated with an axes (e.g., a
357+
# tick label) can be outside the bounding box of the
358+
# axes and inaxes will be None
359+
# also check that ax is None so that it traverse objects
360+
# which do no have an axes property but children might
361+
a.pick(mouseevent)
352362

353363
def set_picker(self, picker):
354364
"""

0 commit comments

Comments
 (0)