Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit339d762

Browse files
committed
FIX: log axes: don't choose major ticks as a minor tick
1 parentaf8a720 commit339d762

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

‎lib/matplotlib/ticker.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2093,9 +2093,7 @@ def is_decade(x, base=10):
20932093

20942094

20952095
defis_close_to_int(x):
2096-
ifnotnp.isfinite(x):
2097-
returnFalse
2098-
returnabs(x-round(x))<1e-10
2096+
returnabs(x-np.round(x))<1e-10
20992097

21002098

21012099
classLogLocator(Locator):
@@ -2256,7 +2254,11 @@ def tick_values(self, vmin, vmax):
22562254
# If we're a minor locator *that expects at least two ticks per
22572255
# decade* and the major locator stride is 1 and there's no more
22582256
# than one minor tick, switch to AutoLocator.
2259-
returnAutoLocator().tick_values(vmin,vmax)
2257+
ticklocs=AutoLocator().tick_values(vmin,vmax)
2258+
# Don't overstrike the major labels.
2259+
ticklocs=ticklocs[
2260+
~is_close_to_int(np.log(ticklocs)/np.log(b))]
2261+
returnticklocs
22602262
returnself.raise_if_exceeds(ticklocs)
22612263

22622264
defview_limits(self,vmin,vmax):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp