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

Appearance settings

Commit 03b07fb

Browse filesBrowse files
authored
Merge pull request #12210 from timhoffm/axes-tick_params-checking
Axes.tick_params() argument checking
2 parents 99eea61 + 2642831 commit 03b07fb
Copy full SHA for 03b07fb

File tree

Expand file treeCollapse file tree

3 files changed

+11
-1
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+11
-1
lines changed
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Axes.tick_params argument checking
2+
``````````````````````````````````
3+
4+
`Axes.tick_params` silently did nothing when an invalid *axis* parameter was
5+
supplied. This behavior is changed to raise a ValueError instead.

‎lib/matplotlib/axes/_base.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_base.py
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2949,6 +2949,8 @@ def tick_params(self, axis='both', **kwargs):
29492949
also be red. Gridlines will be red and translucent.
29502950
29512951
"""
2952+
if axis not in ['x', 'y', 'both']:
2953+
raise ValueError("axis must be one of 'x', 'y' or 'both'")
29522954
if axis in ['x', 'both']:
29532955
xkw = dict(kwargs)
29542956
xkw.pop('left', None)

‎lib/mpl_toolkits/mplot3d/axes3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/mplot3d/axes3d.py
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1412,7 +1412,10 @@ def tick_params(self, axis='both', **kwargs):
14121412
.. versionadded :: 1.1.0
14131413
This function was added, but not tested. Please report any bugs.
14141414
"""
1415-
super().tick_params(axis, **kwargs)
1415+
if axis not in ['x', 'y', 'z', 'both']:
1416+
raise ValueError("axis must be one of 'x', 'y', 'z' or 'both'")
1417+
if axis in ['x', 'y', 'both']:
1418+
super().tick_params(axis, **kwargs)
14161419
if axis in ['z', 'both']:
14171420
zkw = dict(kwargs)
14181421
zkw.pop('top', None)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.