@@ -53,6 +53,36 @@ def cla(self):
53
53
self .xaxis .set_zorder (2.5 )
54
54
self .yaxis .set_zorder (2.5 )
55
55
56
+ # Overwritten so events that actually happened in the host axes still count
57
+ def pick (self , mouseevent ):
58
+ """
59
+ call signature::
60
+
61
+ pick(mouseevent)
62
+
63
+ each child artist will fire a pick event if *mouseevent* is over
64
+ the artist and the artist has picker set
65
+ """
66
+ # Pick self
67
+ if self .pickable ():
68
+ picker = self .get_picker ()
69
+ if six .callable (picker ):
70
+ inside , prop = picker (self , mouseevent )
71
+ else :
72
+ inside , prop = self .contains (mouseevent )
73
+ if inside :
74
+ self .figure .canvas .pick_event (mouseevent , self , ** prop )
75
+
76
+ # Pick children
77
+ for a in self .get_children ():
78
+ # make sure the event happened in the same axes (never happens but
79
+ # whatever) or in host axes
80
+ ax = getattr (a , 'axes' , None )
81
+ if mouseevent .inaxes is None or ax is None or \
82
+ mouseevent .inaxes == ax or \
83
+ (hasattr (mouseevent .inaxes , "parasites" ) and \
84
+ self in mouseevent .inaxes .parasites ):
85
+ a .pick (mouseevent )
56
86
57
87
_parasite_axes_classes = {}
58
88
def parasite_axes_class_factory (axes_class = None ):
@@ -307,6 +337,45 @@ def cla(self):
307
337
#super(HostAxes, self).cla()
308
338
309
339
340
+ # Need to overwrite this so children of parasite axes get picked as well
341
+ def pick (self , mouseevent ):
342
+ """
343
+ call signature::
344
+
345
+ pick(mouseevent)
346
+
347
+ each child artist will fire a pick event if *mouseevent* is over
348
+ the artist and the artist has picker set
349
+ """
350
+ # Pick self
351
+ if self .pickable ():
352
+ picker = self .get_picker ()
353
+ if six .callable (picker ):
354
+ inside , prop = picker (self , mouseevent )
355
+ else :
356
+ inside , prop = self .contains (mouseevent )
357
+ if inside :
358
+ self .figure .canvas .pick_event (mouseevent , self , ** prop )
359
+
360
+ # Pick children
361
+ for a in self .get_children ():
362
+ # make sure the event happened in the same axes
363
+ ax = getattr (a , 'axes' , None )
364
+ if mouseevent .inaxes is None or ax is None or \
365
+ mouseevent .inaxes == ax :
366
+ # we need to check if mouseevent.inaxes is None
367
+ # because some objects associated with an axes (e.g., a
368
+ # tick label) can be outside the bounding box of the
369
+ # axes and inaxes will be None
370
+ # also check that ax is None so that it traverse objects
371
+ # which do no have an axes property but children might
372
+ a .pick (mouseevent )
373
+
374
+ # Pick parasite axes
375
+ for a in self .parasites :
376
+ a .pick (mouseevent )
377
+
378
+
310
379
def twinx (self , axes_class = None ):
311
380
"""
312
381
call signature::
0 commit comments