Skip to content

Commit f52afbf

Browse files
committed
Merge pull request #5780 from anntzer/offsettext-uses-ticks-not-axes-limits
Choose offset text from ticks, not axes limits.
1 parent 4b66272 commit f52afbf

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/matplotlib/ticker.py

+3
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,9 @@ def _set_offset(self, range):
559559
if locs is None or not len(locs) or range == 0:
560560
self.offset = 0
561561
return
562+
vmin, vmax = sorted(self.axis.get_view_interval())
563+
locs = np.asarray(locs)
564+
locs = locs[(vmin <= locs) & (locs <= vmax)]
562565
ave_loc = np.mean(locs)
563566
if ave_loc: # dont want to take log10(0)
564567
ave_oom = math.floor(math.log10(np.mean(np.absolute(locs))))

0 commit comments

Comments
 (0)