-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix xtick.minor.visible only acting on the xaxis #12938
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix xtick.minor.visible only acting on the xaxis #12938
Conversation
lib/matplotlib/scale.py
Outdated
@@ -69,7 +69,8 @@ def set_default_locators_and_formatters(self, axis): | |||
axis.set_major_formatter(ScalarFormatter()) | |||
axis.set_minor_formatter(NullFormatter()) | |||
# update the minor locator for x and y axis based on rcParams | |||
if rcParams['xtick.minor.visible']: | |||
if axis.axis_name in list("xy") and \ | |||
rcParams['{}tick.minor.visible'.format(axis.axis_name)]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO this would be slightly more readable:
if (axis.axis_name == 'x' and rcParams['xtick.minor.visible']
or axis.axis_name == 'y' and rcParams['ytick.minor.visible']):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modulo adding a test.
Don't think we need an image test, just ask the axis if the minor ticks are turned on.
fa4f868
to
ef22343
Compare
ef22343
to
b6fd4e5
Compare
Test added. |
…938-on-v3.0.x Backport PR #12938 on branch v3.0.x (Fix xtick.minor.visible only acting on the xaxis)
* upstream/master: (1723 commits) Correctly get weight & style hints from certain newer Microsoft fonts (matplotlib#12945) Remove some checks for Py<3.6 in the test suite. (matplotlib#12974) Fail-fast when trying to run tests with too-old pytest. Include scatter plots in Qt figure options editor. (matplotlib#12779) ENH: replace deprecated numpy header Minor simplifications. tickminorvisible-fix (matplotlib#12938) Remove animated=True from animation docs Update the documentation of Cursor Misc. cleanups. Add test for 3d conversion of empty PolyCollection Support ~ as nonbreaking space in mathtext. Deprecate public use of Formatter.pprint_val. MAINT: Unify calculation of normal vectors from polygons (matplotlib#12136) Fix the title of testing_api More table documentation Simplify bachelors degree example using new features. Avoid pyplot in showcase examples. Simplify argument checking in Table.__getitem__. (matplotlib#12932) Minor updates following bump to Py3.6+. ... # Conflicts: # lib/matplotlib/widgets.py
PR Summary
#10193 introduced a bug, that when the rc param
xtick.minor.visible
is set toTrue
, also the y-axis would get minor ticks.This PR fixes this.
with this PR
Interestingly though,
plt.rcParams["ytick.minor.visible"] = True
always worked fine. So in that sense I'm not sure if theScale
would even need to set the locator the way it does.PR Checklist