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

Skip to content

Commit 600cdd2

Browse files
committed
ENH: Add API from minor locators to opt-out of tick deconfliction
This adds the logic to check if there is an attribute on the minor locator to control the deconfliction.
1 parent 7680c19 commit 600cdd2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/matplotlib/axis.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1316,6 +1316,7 @@ def get_minorticklocs(self):
13161316
# Remove minor ticks duplicating major ticks.
13171317
major_locs = self.major.locator()
13181318
minor_locs = self.minor.locator()
1319+
deconflict = getattr(self.minor.locator, 'enable_deconflict', True)
13191320
transform = self._scale.get_transform()
13201321
tr_minor_locs = transform.transform(minor_locs)
13211322
tr_major_locs = transform.transform(major_locs)
@@ -1325,7 +1326,8 @@ def get_minorticklocs(self):
13251326
tol = (hi - lo) * 1e-5
13261327
minor_locs = [
13271328
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()]
1329+
if (not deconflict or
1330+
not np.isclose(tr_loc, tr_major_locs, atol=tol, rtol=0).any())]
13291331
return minor_locs
13301332

13311333
def get_ticklocs(self, minor=False):

0 commit comments

Comments
 (0)