@@ -1757,11 +1757,13 @@ class LogLocator(Locator):
1757
1757
Determine the tick locations for log axes
1758
1758
"""
1759
1759
1760
- def __init__ (self , base = 10.0 , subs = [ 1.0 ] , numdecs = 4 , numticks = 15 ):
1760
+ def __init__ (self , base = 10.0 , subs = None , numdecs = 4 , numticks = 15 ):
1761
1761
"""
1762
1762
place ticks on the location= base**i*subs[j]
1763
1763
"""
1764
1764
self .base (base )
1765
+ if subs is None :
1766
+ subs = [1.0 ]
1765
1767
self .subs (subs )
1766
1768
# this needs to be validated > 1 with traitlets
1767
1769
self .numticks = numticks
@@ -1770,9 +1772,9 @@ def __init__(self, base=10.0, subs=[1.0], numdecs=4, numticks=15):
1770
1772
def set_params (self , base = None , subs = None , numdecs = None , numticks = None ):
1771
1773
"""Set parameters within this locator."""
1772
1774
if base is not None :
1773
- self .base = base
1775
+ self .base ( base )
1774
1776
if subs is not None :
1775
- self .subs = subs
1777
+ self .subs ( subs )
1776
1778
if numdecs is not None :
1777
1779
self .numdecs = numdecs
1778
1780
if numticks is not None :
@@ -1782,7 +1784,7 @@ def base(self, base):
1782
1784
"""
1783
1785
set the base of the log scaling (major tick every base**i, i integer)
1784
1786
"""
1785
- self ._base = base + 0.0
1787
+ self ._base = float ( base )
1786
1788
1787
1789
def subs (self , subs ):
1788
1790
"""
@@ -1791,7 +1793,7 @@ def subs(self, subs):
1791
1793
if subs is None :
1792
1794
self ._subs = None # autosub
1793
1795
else :
1794
- self ._subs = np .asarray (subs ) + 0.0
1796
+ self ._subs = np .asarray (subs , dtype = float )
1795
1797
1796
1798
def __call__ (self ):
1797
1799
'Return the locations of the ticks'
@@ -1839,6 +1841,7 @@ def tick_values(self, vmin, vmax):
1839
1841
if not self .numticks > 1 :
1840
1842
raise RuntimeError ('The number of ticks must be greater than 1 '
1841
1843
'for LogLocator.' )
1844
+ # FIXME: The following was designed for integer division in py2.
1842
1845
while numdec / stride + 1 > self .numticks :
1843
1846
stride += 1
1844
1847
0 commit comments