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

Skip to content

Commit 7c9acc0

Browse files
committed
Fix test, and make minor ticks work again
1 parent 177f560 commit 7c9acc0

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

lib/matplotlib/tests/test_ticker.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ def test_LogLocator_set_params():
9494
Should not exception.
9595
"""
9696
loc = mticker.LogLocator()
97-
loc.set_params(numticks=8, numdecs=8, subs=[2.0], base=8)
98-
nose.tools.assert_equal(loc.numticks, 8)
97+
loc.set_params(numticks=7, numdecs=8, subs=[2.0], base=4)
98+
nose.tools.assert_equal(loc.numticks, 7)
9999
nose.tools.assert_equal(loc.numdecs, 8)
100-
nose.tools.assert_equal(loc.base, 8)
101-
nose.tools.assert_equal(loc.subs, [2.0])
100+
nose.tools.assert_equal(loc._base, 4)
101+
nose.tools.assert_equal(list(loc._subs), [2.0])
102102

103103

104104
def test_NullLocator_set_params():

lib/matplotlib/ticker.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1757,13 +1757,11 @@ class LogLocator(Locator):
17571757
Determine the tick locations for log axes
17581758
"""
17591759

1760-
def __init__(self, base=10.0, subs=None, numdecs=4, numticks=15):
1760+
def __init__(self, base=10.0, subs=(1.0,), numdecs=4, numticks=15):
17611761
"""
17621762
place ticks on the location= base**i*subs[j]
17631763
"""
17641764
self.base(base)
1765-
if subs is None:
1766-
subs = [1.0]
17671765
self.subs(subs)
17681766
# this needs to be validated > 1 with traitlets
17691767
self.numticks = numticks

0 commit comments

Comments
 (0)