@@ -1158,7 +1158,7 @@ class AutoDateLocator(DateLocator):
11581158 locations.
11591159 """
11601160 def __init__ (self , tz = None , minticks = 5 , maxticks = None ,
1161- interval_multiples = False ):
1161+ interval_multiples = True ):
11621162 """
11631163 *minticks* is the minimum number of ticks desired, which is used to
11641164 select the type of ticking (yearly, monthly, etc.).
@@ -1234,6 +1234,12 @@ def __init__(self, tz=None, minticks=5, maxticks=None,
12341234 MICROSECONDLY : [1 , 2 , 5 , 10 , 20 , 50 , 100 , 200 , 500 , 1000 , 2000 ,
12351235 5000 , 10000 , 20000 , 50000 , 100000 , 200000 , 500000 ,
12361236 1000000 ]}
1237+ if interval_multiples :
1238+ # Swap "3" for "4" in the DAILY list; If we use 3 we get bad
1239+ # tick loc for months w/ 31 days: 1, 4,..., 28, 31, 1
1240+ # If we use 4 then we get: 1, 5, ... 25, 29, 1
1241+ self .intervald [DAILY ] = [1 , 2 , 4 , 7 , 14 , 21 ]
1242+
12371243 self ._byranges = [None , range (1 , 13 ), range (1 , 32 ),
12381244 range (0 , 24 ), range (0 , 60 ), range (0 , 60 ), None ]
12391245
@@ -1338,7 +1344,11 @@ def get_locator(self, dmin, dmax):
13381344 self ._freq = freq
13391345
13401346 if self ._byranges [i ] and self .interval_multiples :
1341- byranges [i ] = self ._byranges [i ][::interval ]
1347+ if i == DAILY and interval == 14 :
1348+ # just make first and 15th. Avoids 30th.
1349+ byranges [i ] = [1 , 15 ]
1350+ else :
1351+ byranges [i ] = self ._byranges [i ][::interval ]
13421352 interval = 1
13431353 else :
13441354 byranges [i ] = self ._byranges [i ]
0 commit comments