Skip to content

Commit

Permalink
Merge pull request #5780 from anntzer/offsettext-uses-ticks-not-axes-…
Browse files Browse the repository at this point in the history
…limits

Choose offset text from ticks, not axes limits.
  • Loading branch information
tacaswell committed Jan 1, 2016
1 parent 4b66272 commit f52afbf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/matplotlib/ticker.py
Expand Up @@ -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))))
Expand Down

0 comments on commit f52afbf

Please sign in to comment.