File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -1316,6 +1316,9 @@ def get_minorticklocs(self):
1316
1316
# Remove minor ticks duplicating major ticks.
1317
1317
major_locs = self .major .locator ()
1318
1318
minor_locs = self .minor .locator ()
1319
+ # we do check when we set the attribute that this is a Locator
1320
+ # subclass, use getattr out of an over abundance of caution
1321
+ remove_overlaps = getattr (self .minor .locator , 'remove_overlaps' , True )
1319
1322
transform = self ._scale .get_transform ()
1320
1323
tr_minor_locs = transform .transform (minor_locs )
1321
1324
tr_major_locs = transform .transform (major_locs )
@@ -1325,7 +1328,8 @@ def get_minorticklocs(self):
1325
1328
tol = (hi - lo ) * 1e-5
1326
1329
minor_locs = [
1327
1330
loc for loc , tr_loc in zip (minor_locs , tr_minor_locs )
1328
- if not np .isclose (tr_loc , tr_major_locs , atol = tol , rtol = 0 ).any ()]
1331
+ if (not remove_overlaps or
1332
+ not np .isclose (tr_loc , tr_major_locs , atol = tol , rtol = 0 ).any ())]
1329
1333
return minor_locs
1330
1334
1331
1335
def get_ticklocs (self , minor = False ):
Original file line number Diff line number Diff line change @@ -1469,6 +1469,11 @@ class Locator(TickHelper):
1469
1469
# many ticks are generated.
1470
1470
MAXTICKS = 1000
1471
1471
1472
+ # Default to requsting minor locators have overlapping ticks with the
1473
+ # major locator removed. If you want to have overlapping ticks, set
1474
+ # this to False on the Locator instance.
1475
+ remove_overlaps = True
1476
+
1472
1477
def tick_values (self , vmin , vmax ):
1473
1478
"""
1474
1479
Return the values of the located ticks given **vmin** and **vmax**.
You can’t perform that action at this time.
0 commit comments