Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fc00626

Browse files
committed
FIX: make MaxNLocator only follow visible ticks for order of magnitude
1 parent 5e20d9b commit fc00626

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/matplotlib/ticker.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,11 @@ def _set_orderOfMagnitude(self, range):
712712
# fixed scaling when lower power limit = upper <> 0.
713713
self.orderOfMagnitude = self._powerlimits[0]
714714
return
715-
locs = np.abs(self.locs)
715+
# restrict to visible ticks
716+
vmin, vmax = sorted(self.axis.get_view_interval())
717+
locs = np.asarray(self.locs)
718+
locs = locs[(vmin <= locs) & (locs <= vmax)]
719+
locs = np.abs(locs)
716720
if self.offset:
717721
oom = math.floor(math.log10(range))
718722
else:

0 commit comments

Comments
 (0)