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

Skip to content

Commit 325205e

Browse files
committed
Merge pull request #5267 from cimarronm/autominorlocator_checkscale
AutoMinorLocator and and logarithmic axis
2 parents aeb6112 + 19baac5 commit 325205e

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

lib/matplotlib/ticker.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2145,8 +2145,7 @@ def __init__(self):
21452145
class AutoMinorLocator(Locator):
21462146
"""
21472147
Dynamically find minor tick positions based on the positions of
2148-
major ticks. Assumes the scale is linear and major ticks are
2149-
evenly spaced.
2148+
major ticks. The scale must be linear with major ticks evenly spaced.
21502149
"""
21512150
def __init__(self, n=None):
21522151
"""
@@ -2160,6 +2159,11 @@ def __init__(self, n=None):
21602159

21612160
def __call__(self):
21622161
'Return the locations of the ticks'
2162+
if self.axis.get_scale() == 'log':
2163+
warnings.warn('AutoMinorLocator does not work with logarithmic '
2164+
'scale')
2165+
return []
2166+
21632167
majorlocs = self.axis.get_majorticklocs()
21642168
try:
21652169
majorstep = majorlocs[1] - majorlocs[0]

0 commit comments

Comments
 (0)