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

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
< 8000 div class="prc-PageLayout-Pane-Vl5LI" data-resizable="true" style="--spacing:var(--spacing-normal);--pane-min-width:256px;--pane-max-width:calc(100vw - var(--pane-max-width-diff));--pane-width-size:var(--pane-width-medium);--pane-width:296px">

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)
0