8000 PRF: minor performance tweaks · matplotlib/matplotlib@a4557c2 · GitHub
[go: up one dir, main page]

Skip to content

Commit a4557c2

Browse files
committed
PRF: minor performance tweaks
1 parent 2d0cc7d commit a4557c2

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2813,15 +2813,14 @@ def mouse_move(self, event):
28132813
pass
28142814
else:
28152815
artists = event.inaxes.hitlist(event)
2816-
if event.inaxes.patch in artists:
2817-
artists.remove(event.inaxes.patch)
28182816

28192817
if artists:
2820-
artists.sort(key=lambda x: x.zorder)
2821-
a = artists[-1]
2822-
data = a.get_cursor_data(event)
2823-
if data is not None:
2824-
s += ' [%s]' % a.format_cursor_data(data)
2818+
a = max(enumerate(artists), key=lambda x: x[1].zorder)[1]
2819+
if a is not event.inaxes.patch:
2820+
data = a.get_cursor_data(event)
2821+
if data is not None:
2822+
s += ' [%s]' % a.format_cursor_data(data)
2823+
28252824
if len(self.mode):
28262825
self.set_message('%s, %s' % (self.mode, s))
28272826
else:

0 commit comments

Comments
 (0)
0