Skip to content

Commit fd04111

Browse files
jor-tacaswell
authored andcommitted
ENH: LogLocator: check for correct dimension of subs added
1 parent 145ade6 commit fd04111

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/matplotlib/ticker.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2382,7 +2382,16 @@ def subs(self, subs):
23822382
cbook._check_in_list(('all', 'auto'), subs=subs)
23832383
self._subs = subs
23842384
else:
2385-
self._subs = np.asarray(subs, dtype=float)
2385+
try:
2386+
self._subs = np.asarray(subs, dtype=float)
2387+
except ValueError as e:
2388+
raise ValueError("If subs is not None and not a string, "
2389+
"it must be a sequence of float.") from e
2390+
if self._subs.ndim != 1:
2391+
raise ValueError("If subs is not None and not a string, it "
2392+
"must be a sequence of float. Hence subs "
2393+
"should have 1 dimension but it has {} "
2394+
"dimensions.".format(self._subs.ndim))
23862395

23872396
def __call__(self):
23882397
'Return the locations of the ticks'

0 commit comments

Comments
 (0)