Skip to content

Commit 170ad23

Browse files
committed
Don't create minor ticks on top of existing major ticks (Neil Crighton).
svn path=/trunk/matplotlib/; revision=8083
1 parent 2a41fbe commit 170ad23

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2009-01-16 Don't create minor ticks on top of existing major
2+
ticks. Patch by Neil Crighton. -ADS
3+
14
2009-01-16 Ensure three minor ticks always drawn (SF# 2924245). Patch
25
by Neil Crighton. -ADS
36

lib/matplotlib/ticker.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1334,8 +1334,13 @@ def __call__(self):
13341334
vmin, vmax = self.axis.get_view_interval()
13351335
if vmin > vmax:
13361336
vmin,vmax = vmax,vmin
1337+
locs = locs[(vmin < locs) & (locs < vmax)]
13371338

1338-
return self.raise_if_exceeds(locs[(vmin < locs) & (locs < vmax)])
1339+
# don't create minor ticks on top of existing major ticks
1340+
diff = 0.5 * abs(locs[1] - locs[0])
1341+
locs = [l for l in locs if (np.abs(l - majorlocs) > diff).all()]
1342+
1343+
return self.raise_if_exceeds(np.array(locs))
13391344

13401345

13411346
class OldAutoLocator(Locator):

0 commit comments

Comments
 (0)