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

Skip to content

Commit e329e12

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

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/matplotlib/scale.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,9 @@ def __init__(self, axis, **kwargs):
247247
if nonpos not in ['mask', 'clip']:
248248
raise ValueError("nonposx, nonposy kwarg must be 'mask' or 'clip'")
249249

250+
if base <= 0 or base == 1:
251+
raise ValueError('The log base cannot be <= 0 or == 1.')
252+
250253
if base == 10.0:
251254
self._transform = self.Log10Transform(nonpos)
252255
elif base == 2.0:

0 commit comments

Comments
 (0)