From 4d455929ba28a8777cee45b0098a1416c2f27de6 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Fri, 1 Jan 2016 00:26:37 -0800 Subject: [PATCH] Choose offset text from ticks, not axes limits. --- lib/matplotlib/ticker.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/matplotlib/ticker.py b/lib/matplotlib/ticker.py index a2fb0a6e674a..2f2bb96b97d1 100644 --- a/lib/matplotlib/ticker.py +++ b/lib/matplotlib/ticker.py @@ -559,6 +559,9 @@ def _set_offset(self, range): if locs is None or not len(locs) or range == 0: self.offset = 0 return + vmin, vmax = sorted(self.axis.get_view_interval()) + locs = np.asarray(locs) + locs = locs[(vmin <= locs) & (locs <= vmax)] ave_loc = np.mean(locs) if ave_loc: # dont want to take log10(0) ave_oom = math.floor(math.log10(np.mean(np.absolute(locs))))