diff --git a/lib/matplotlib/backend_bases.py b/lib/matplotlib/backend_bases.py index c82e0f34850c..d0b59e5b7524 100644 --- a/lib/matplotlib/backend_bases.py +++ b/lib/matplotlib/backend_bases.py @@ -2813,15 +2813,14 @@ def mouse_move(self, event): pass else: artists = event.inaxes.hitlist(event) - if event.inaxes.patch in artists: - artists.remove(event.inaxes.patch) if artists: - artists.sort(key=lambda x: x.zorder) - a = artists[-1] - data = a.get_cursor_data(event) - if data is not None: - s += ' [%s]' % a.format_cursor_data(data) + a = max(enumerate(artists), key=lambda x: x[1].zorder)[1] + if a is not event.inaxes.patch: + data = a.get_cursor_data(event) + if data is not None: + s += ' [%s]' % a.format_cursor_data(data) + if len(self.mode): self.set_message('%s, %s' % (self.mode, s)) else: diff --git a/lib/matplotlib/transforms.py b/lib/matplotlib/transforms.py index 75fda8c1d230..0df6ea4c4b12 100644 --- a/lib/matplotlib/transforms.py +++ b/lib/matplotlib/transforms.py @@ -50,7 +50,8 @@ from .path import Path DEBUG = False - +# we need this later, but this is very expensive to set up +MINFLOAT = np.MachAr(float).xmin MaskedArray = ma.MaskedArray @@ -2738,7 +2739,7 @@ def nonsingular(vmin, vmax, expander=0.001, tiny=1e-15, increasing=True): swapped = True maxabsvalue = max(abs(vmin), abs(vmax)) - if maxabsvalue < (1e6 / tiny) * np.MachAr(float).xmin: + if maxabsvalue < (1e6 / tiny) * MINFLOAT: vmin = -expander vmax = expander