Skip to content

Commit 6d7c930

Browse files
committed
Added a contains() method to matplotlib.legend.Legend(). It was
missing previously.
1 parent d664879 commit 6d7c930

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/matplotlib/legend.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def __init__(self, legend, use_blit=False, update="loc"):
5050
use_blit=use_blit)
5151

5252
def artist_picker(self, legend, evt):
53-
return self.legend.legendPatch.contains(evt)
53+
return self.legend.contains(evt)
5454

5555
def finalize_offset(self):
5656
loc_in_canvas = self.get_loc_in_canvas()
@@ -924,6 +924,8 @@ def _find_best_position(self, width, height, renderer, consider=None):
924924

925925
return ox, oy
926926

927+
def contains(self, event):
928+
return self.legendPatch.contains(event)
927929

928930
def draggable(self, state=None, use_blit=False, update="loc"):
929931
"""

0 commit comments

Comments
 (0)