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

Commitef22343

Browse files
tickminorvisible-fix
1 parent99d8900 commitef22343

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

‎lib/matplotlib/scale.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ def set_default_locators_and_formatters(self, axis):
6969
axis.set_major_formatter(ScalarFormatter())
7070
axis.set_minor_formatter(NullFormatter())
7171
# update the minor locator for x and y axis based on rcParams
72-
ifrcParams['xtick.minor.visible']:
72+
if (axis.axis_name=='x'andrcParams['xtick.minor.visible']
73+
oraxis.axis_name=='y'andrcParams['ytick.minor.visible']):
7374
axis.set_minor_locator(AutoMinorLocator())
7475
else:
7576
axis.set_minor_locator(NullLocator())

‎lib/matplotlib/tests/test_ticker.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,3 +851,21 @@ def test_minlocator_type():
851851
fig,ax=plt.subplots()
852852
withpytest.raises(TypeError):
853853
ax.xaxis.set_minor_locator(matplotlib.ticker.LogFormatter())
854+
855+
856+
deftest_minorticks_rc():
857+
fig=plt.figure()
858+
859+
defminorticksubplot(xminor,yminor,i):
860+
rc= {'xtick.minor.visible' :xminor,
861+
'ytick.minor.visible' :yminor}
862+
withplt.rc_context(rc=rc):
863+
ax=fig.add_subplot(2,2,i)
864+
865+
assert (len(ax.xaxis.get_minor_ticks())>0)==xminor
866+
assert (len(ax.yaxis.get_minor_ticks())>0)==yminor
867+
868+
minorticksubplot(False,False,1)
869+
minorticksubplot(True,False,2)
870+
minorticksubplot(False,True,3)
871+
minorticksubplot(True,True,4)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp