Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ecc6212

Browse files
committed
Fix docstring; validate subs
1 parent 37fcaf2 commit ecc6212

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/matplotlib/ticker.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -876,8 +876,8 @@ def label_minor(self, labelOnlyBase):
876876
877877
Parameters
878878
----------
879-
labelOnlyBase : bool, optional, default: True
880-
If true, label ticks only at integer powers of base.
879+
labelOnlyBase : bool
880+
If True, label ticks only at integer powers of base.
881881
882882
"""
883883
self.labelOnlyBase = labelOnlyBase
@@ -1908,7 +1908,9 @@ def subs(self, subs):
19081908
if subs is None: # consistency with previous bad API
19091909
self._subs = 'auto'
19101910
elif cbook.is_string_like(subs):
1911-
# TODO: validation ('all', 'auto')
1911+
if subs not in ('all', 'auto'):
1912+
raise ValueError("A subs string must be 'all' or 'auto'; "
1913+
"found '%s'." % subs)
19121914
self._subs = subs
19131915
else:
19141916
self._subs = np.asarray(subs, dtype=float)
@@ -2045,8 +2047,8 @@ def __init__(self, transform=None, subs=None, linthresh=None, base=None):
20452047
self._base = base
20462048
self._linthresh = linthresh
20472049
else:
2048-
raise ValueError("Either transform or linthresh "
2049-
"and base must be provided.")
2050+
raise ValueError("Either transform, or both linthresh "
2051+
"and base, must be provided.")
20502052
if subs is None:
20512053
self._subs = [1.0]
20522054
else:

0 commit comments

Comments
 (0)