8000 TST: add test · matplotlib/matplotlib@6e15b71 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6e15b71

Browse files
committed
TST: add test
1 parent 339d762 commit 6e15b71

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

lib/matplotlib/tests/test_ticker.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ def test_switch_to_autolocator(self):
183183
loc = mticker.LogLocator(subs="all")
184184
assert_array_equal(loc.tick_values(0.45, 0.55),
185185
[0.44, 0.46, 0.48, 0.5, 0.52, 0.54, 0.56])
186+
# check that we *skip* 1.0, and 10, because this is a minor locator
187+
loc = mticker.LogLocator(subs=np.arange(2, 10))
188+
assert not 1.0 in loc.tick_values(0.9, 20.)
189+
assert not 10.0 in loc.tick_values(0.9, 20.)
186190

187191
def test_set_params(self):
188192
"""

lib/matplotlib/ticker.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2248,6 +2248,7 @@ def tick_values(self, vmin, vmax):
22482248
ticklocs = b ** decades
22492249

22502250
_log.debug('ticklocs %r', ticklocs)
2251+
print('subs', subs, have_subs, ticklocs)
22512252
if (len(subs) > 1
22522253
and stride == 1
22532254
and ((vmin <= ticklocs) & (ticklocs <= vmax)).sum() <= 1):
@@ -2258,6 +2259,7 @@ def tick_values(self, vmin, vmax):
22582259
# Don't overstrike the major labels.
22592260
ticklocs = ticklocs[
22602261
~is_close_to_int(np.log(ticklocs) / np.log(b))]
2262+
print('ticklocs', ticklocs)
22612263
return ticklocs
22622264
return self.raise_if_exceeds(ticklocs)
22632265

0 commit comments

Comments
 (0)
0