Skip to content

Commit 6d03ed8

Browse files
authored
fix: revert simplification of stride calculation in LogLocator (#3)
The attempt to simplify the stride calculation in `a06f343dee3cebf035b74f65ea00b8842af448e9` seems to be the cause of the problem. Using an approach equivalent to what was there before hopefully resolves matplotlib#24092.
1 parent 01eff90 commit 6d03ed8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/matplotlib/ticker.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -2386,7 +2386,8 @@ def tick_values(self, vmin, vmax):
23862386
# Get decades between major ticks.
23872387
stride = (max(math.ceil(numdec / (numticks - 1)), 1)
23882388
if mpl.rcParams['_internal.classic_mode'] else
2389-
(numdec + 1) // numticks + 1)
2389+
next(s for s in itertools.count(1)
2390+
if numdec // s + 1 <= numticks))
23902391

23912392
# if we have decided that the stride is as big or bigger than
23922393
# the range, clip the stride back to the available range - 1

0 commit comments

Comments
 (0)