@@ -1333,7 +1333,7 @@ class MaxNLocator(Locator):
1333
1333
"""
1334
1334
Select no more than N intervals at nice locations.
1335
1335
"""
1336
- default_params = dict (nbins = 10 ,
1336
+ default_params = dict (nbins = None ,
1337
1337
steps = None ,
1338
1338
trim = True ,
1339
1339
integer = False ,
@@ -1345,7 +1345,9 @@ def __init__(self, *args, **kwargs):
1345
1345
Keyword args:
1346
1346
1347
1347
*nbins*
1348
- Maximum number of intervals; one less than max number of ticks.
1348
+ Maximum number of intervals; one less than max number of
1349
+ ticks. If `None`, the number of bins will be
1350
+ automatically determined based on the length of the axis.
1349
1351
1350
1352
*steps*
1351
1353
Sequence of nice numbers starting with 1 and ending with 10;
@@ -1412,6 +1414,8 @@ def set_params(self, **kwargs):
1412
1414
1413
1415
def bin_boundaries (self , vmin , vmax ):
1414
1416
nbins = self ._nbins
1417
+ if nbins is None :
1418
+ nbins = self .axis .get_tick_space ()
1415
1419
scale , offset = scale_range (vmin , vmax , nbins )
1416
1420
if self ._integer :
1417
1421
scale = max (1 , scale )
@@ -1462,52 +1466,6 @@ def view_limits(self, dmin, dmax):
1462
1466
return np .take (self .bin_boundaries (dmin , dmax ), [0 , - 1 ])
1463
1467
1464
1468
1465
- class AutoSpacedLocator (MaxNLocator ):
1466
- """
1467
- Behaves like a MaxNLocator, except N is automatically determined
1468
- from the length of the axis.
1469
- """
1470
- def __init__ (self , steps = None , integer = False , symmetric = False , prune = None ):
1471
- """
1472
- Keyword args:
1473
-
1474
- *steps*
1475
- Sequence of nice numbers starting with 1 and ending with 10;
1476
- e.g., [1, 2, 4, 5, 10]
1477
-
1478
- *integer*
1479
- If True, ticks will take only integer values.
1480
-
1481
- *symmetric*
1482
- If True, autoscaling will result in a range symmetric
1483
- about zero.
1484
-
1485
- *prune*
1486
- ['lower' | 'upper' | 'both' | None]
1487
- Remove edge ticks -- useful for stacked or ganged plots
1488
- where the upper tick of one axes overlaps with the lower
1489
- tick of the axes above it.
1490
- If prune=='lower', the smallest tick will
1491
- be removed. If prune=='upper', the largest tick will be
1492
- removed. If prune=='both', the largest and smallest ticks
1493
- will be removed. If prune==None, no ticks will be removed.
1494
-
1495
- """
1496
- self .set_params (** self .default_params )
1497
- self .set_params (steps = steps , integer = integer , symmetric = symmetric ,
1498
- prune = prune )
1499
-
1500
- def set_params (self , ** kwargs ):
1501
- if 'nbins' in kwargs :
1502
- raise TypeError (
1503
- "set_params got an unexpected keyword argument 'nbins'" )
1504
- return super (AutoSpacedLocator , self ).set_params (** kwargs )
1505
-
1506
- def __call__ (self ):
1507
- self ._nbins = self .axis .get_tick_space ()
1508
- return super (AutoSpacedLocator , self ).__call__ ()
1509
-
1510
-
1511
1469
def decade_down (x , base = 10 ):
1512
1470
'floor x to the nearest lower decade'
1513
1471
if x == 0.0 :
@@ -1931,15 +1889,13 @@ def tick_values(self, vmin, vmax):
1931
1889
return self .raise_if_exceeds (np .array (ticklocs ))
1932
1890
1933
1891
1934
- class AutoLocator (AutoSpacedLocator ):
1892
+ class AutoLocator (MaxNLocator ):
1935
1893
def __init__ (self ):
1936
- AutoSpacedLocator .__init__ (self , steps = [1 , 2 , 5 , 10 ])
1937
-
1938
-
1939
- class ClassicAutoLocator (MaxNLocator ):
1940
- # Used only for classic style
1941
- def __init__ (self ):
1942
- MaxNLocator .__init__ (self , nbins = 9 , steps = [1 , 2 , 5 , 10 ])
1894
+ if rcParams ['_internal.classic_mode' ]:
1895
+ nbins = 9
1896
+ else :
1897
+ nbins = None
1898
+ MaxNLocator .__init__ (self , nbins = nbins , steps = [1 , 2 , 5 , 10 ])
1943
1899
1944
1900
1945
1901
class AutoMinorLocator (Locator ):
0 commit comments