8000 Raise a ValueError when trying to init a LogScale with an invalid base · matplotlib/matplotlib@b8d84b4 · GitHub
[go: up one dir, main page]

Skip to content

Commit b8d84b4

Browse files
committed
Raise a ValueError when trying to init a LogScale with an invalid base
1 parent 4680c62 commit b8d84b4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/matplotlib/scale.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,8 @@ def __init__(self, axis, **kwargs):
246246

247247
if nonpos not in ['mask', 'clip']:
248248
raise ValueError("nonposx, nonposy kwarg must be 'mask' or 'clip'")
249+
if base <= 0 or base == 1:
250+
raise ValueError('The log base cannot be <= 0 or == 1.')
249251

250252
if base == 10.0:
251253
self._transform = self.Log10Transform(nonpos)

0 commit comments

Comments
 (0)
0